Creating a simple shuffle play button
-
I've been wanting this feature for a long time, so I'm developing it myself. I have never worked with qt before so require a little help.
I would like to have a button that starts playing the playlist after shuffling (instead of having to manually click on a random track from the playlist, it's just inconvenient). This button would be positioned between the "Clear Playlist" and "Undo" buttons.
I probably would have to create a new action in mainwindow.ui and add it to
ui_->playlist->SetActions
. And then create a corresponding functionPlaylistShufflePlay()
for it where shuffle (I couldn't find a function for this) is called before callingPlaylistPlay()
.Can somebody point me in the right direction on how this should be implemented?
-
Hi @jonas can you help me?
-
@user1234
I don't understand what you want to do here. Why can't you just press play?
But you would need to do this in Mainwindow, Player and Playlist classes. -
I don't understand what you want to do here.
I'll try to explain again:
- So, let's say I'm playing a track from playlist A
- Now, I would like to start playing a random track from playlist B
To do this, I would have to
- Click on playlist B
- Select a random track manually from playlist B (or ctrl+h and then select a track)
- Double click on the track to start playing it
Why can't you just press play?
- The play button controls the currently playing track (from playlist A, in my example)
- So, pressing play just plays/pauses the current playing track
Solution
- A button that shuffles the current selected playlist (not the one that is currently playing) and then plays a track from it.
Behavior when using this modified feature
- I am playing a track from playlist A
- I press play/pause button: the current track plays/pauses
- I click on playlist B
- There is a "Shuffle Play" button between the "Clear Playlist" and "Undo" buttons. I click on "Shuffle Play"
- The playlist B is shuffled and a random track from the playlist B starts playing
Hope this makes it clear. I'm pretty sure many people would like to have such a feature, it is pretty convenient this way.