Changeset 26264
- Timestamp:
- 07/05/08 15:21:38 (5 months ago)
- Location:
- haiku/trunk/src/apps/mediaplayer
- Files:
-
- 2 added
- 7 modified
-
Jamfile (modified) (1 diff)
-
MainApp.cpp (modified) (2 diffs)
-
playlist/MovePLItemsCommand.cpp (modified) (2 diffs)
-
playlist/Playlist.h (modified) (1 diff)
-
playlist/PlaylistListView.cpp (modified) (2 diffs)
-
playlist/PlaylistListView.h (modified) (1 diff)
-
playlist/PlaylistWindow.cpp (modified) (3 diffs)
-
playlist/RandomizePLItemsCommand.cpp (added)
-
playlist/RandomizePLItemsCommand.h (added)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/apps/mediaplayer/Jamfile
r26066 r26264 62 62 PlaylistObserver.cpp 63 63 PlaylistWindow.cpp 64 RandomizePLItemsCommand.cpp 64 65 RemovePLItemsCommand.cpp 65 66 -
haiku/trunk/src/apps/mediaplayer/MainApp.cpp
r25725 r26264 29 29 30 30 #include <stdio.h> 31 #include <stdlib.h> 31 32 #include <unistd.h> 32 33 … … 226 227 EventQueue::CreateDefault(); 227 228 229 srand(system_time()); 230 228 231 gMainApp = new MainApp; 229 232 gMainApp->Run(); -
haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp
r21317 r26264 44 44 for (int32 i = 0; i < fCount; i++) { 45 45 if (fPlaylist->GetRefAt(fIndices[i], &fRefs[i]) < B_OK) { 46 // indicate a bad object state 46 47 delete[] fRefs; 47 48 fRefs = NULL; … … 65 66 MovePLItemsCommand::InitCheck() 66 67 { 67 if (!f Playlist || !fRefs || !fIndices)68 if (!fRefs) 68 69 return B_NO_INIT; 69 70 -
haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h
r24715 r26264 53 53 void MakeEmpty(); 54 54 int32 CountItems() const; 55 55 56 56 void Sort(); 57 57 -
haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp
r26142 r26264 27 27 #include "Playlist.h" 28 28 #include "PlaylistObserver.h" 29 #include "RandomizePLItemsCommand.h" 29 30 #include "RemovePLItemsCommand.h" 30 31 … … 376 377 377 378 379 void 380 PlaylistListView::Randomize() 381 { 382 int32 count = CountItems(); 383 if (count == 0) 384 return; 385 386 BList indices; 387 388 // add current selection 389 count = 0; 390 while (true) { 391 int32 index = CurrentSelection(count); 392 if (index < 0) 393 break; 394 if (!indices.AddItem((void*)index)) 395 return; 396 count++; 397 } 398 399 // was anything selected? 400 if (count == 0) { 401 // no selection, simply add all items 402 count = CountItems(); 403 for (int32 i = 0; i < count; i++) { 404 if (!indices.AddItem((void*)i)) 405 return; 406 } 407 } 408 409 fCommandStack->Perform(new (nothrow) RandomizePLItemsCommand(fPlaylist, 410 (int32*)indices.Items(), indices.CountItems())); 411 } 412 413 378 414 // #pragma mark - 379 415 -
haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h
r21317 r26264 45 45 int32 appendIndex); 46 46 47 void Randomize(); 48 47 49 private: 48 50 void _FullSync(); -
haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
r26144 r26264 32 32 33 33 enum { 34 M_PLAYLIST_OPEN = 'open', 35 M_PLAYLIST_SAVE = 'save', 36 M_PLAYLIST_EMPTY = 'emty' 34 // file 35 M_PLAYLIST_OPEN = 'open', 36 M_PLAYLIST_SAVE = 'save', 37 38 // edit 39 M_PLAYLIST_EMPTY = 'emty', 40 M_PLAYLIST_RANDOMIZE = 'rand' 37 41 }; 38 42 … … 145 149 fOpenPanel->Show(); 146 150 break; 151 147 152 case M_PLAYLIST_EMPTY: 148 153 fListView->RemoveAll(); 149 break; 154 break; 155 case M_PLAYLIST_RANDOMIZE: 156 fListView->Randomize(); 157 break; 158 150 159 default: 151 160 BWindow::MessageReceived(message); … … 181 190 editMenu->AddItem(new BMenuItem("Make Empty", 182 191 new BMessage(M_PLAYLIST_EMPTY), 'N')); 192 editMenu->AddItem(new BMenuItem("Randomize", 193 new BMessage(M_PLAYLIST_RANDOMIZE), 'R')); 183 194 menuBar->AddItem(editMenu); 184 195
