Changeset 19 for gui/main_window.cpp
- Timestamp:
- 12/31/07 11:58:35 (4 years ago)
- File:
-
- 1 edited
-
gui/main_window.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gui/main_window.cpp
r18 r19 42 42 connect(playlistTableView, SIGNAL(activated(const QModelIndex &)), this, SLOT(playlistItemActivated(const QModelIndex &))); 43 43 connect(removeFromPlaylistPushButton, SIGNAL(clicked(bool)), this, SLOT(removeFromPlaylist())); 44 connect(libraryTreeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(libraryItemActivated(const QModelIndex &))); 44 45 45 46 // Timer … … 202 203 mpd.removeSongs(toBeRemoved); 203 204 } 205 206 void MainWindow::libraryItemActivated(const QModelIndex & index) 207 { 208 QStringList files; 209 MusicLibraryItem *item; 210 QModelIndex mappedIndex = libraryProxyModel.mapToSource(index); 211 item = static_cast<MusicLibraryItem *>(mappedIndex.internalPointer()); 212 213 switch(item->type()) { 214 case MusicLibraryItem::Type_Artist: 215 for(qint32 i = 0; i < item->childCount(); i++) { 216 for(qint32 j = 0; j < item->child(i)->childCount(); j++) 217 files.append(item->child(i)->child(j)->file()); 218 } 219 break; 220 case MusicLibraryItem::Type_Album: 221 for(qint32 i = 0; i < item->childCount(); i++) 222 files.append(item->child(i)->file()); 223 break; 224 case MusicLibraryItem::Type_Song: 225 if(item->type() == MusicLibraryItem::Type_Song) 226 files.append(item->file()); 227 break; 228 default: 229 break; 230 } 231 232 if(!files.isEmpty()) { 233 mpd.add(files); 234 mpd.startPlayingSong(); 235 } 236 }
Note: See TracChangeset
for help on using the changeset viewer.
