Ticket #4077: queue3.patch

File queue3.patch, 3.3 KB (added by Paul Lambert <paul at planar.id.au>, 13 years ago)
  • mythmusic/mythmusic/playbackbox.cpp

     
    464464    else if (keyboard_accelerators)
    465465    {
    466466        for (unsigned int i = 0; i < actions.size() && !handled; i++)
    467         {
     467        {   
    468468            QString action = actions[i];
    469469            handled = true;
    470470
     
    627627        playlist_popup->addButton(tr("Tracks from current Genre"), this,
    628628                                  SLOT(byGenre()));
    629629        playlist_popup->addButton(tr("Tracks from current Year"), this,
    630                                   SLOT(byYear()));
     630                                  SLOT(byYear()));                                 
     631        playlist_popup->addButton(tr("Add playing to active play queue"), this,
     632                                  SLOT(addPlayingtoActive()));
     633        playlist_popup->addButton(tr("Add selected to active play queue"), this,
     634                                  SLOT(addSelectedtoActive()));
    631635    }
    632636   
    633637    playlist_popup->ShowPopup(this, SLOT(closePlaylistPopup()));
     
    750754    updatePlaylistFromQuickPlaylist(whereClause);
    751755}
    752756
     757void PlaybackBoxMusic::addPlayingtoActive()
     758// adds the currently playing track to the active play queue
     759{
     760    if (!playlist_popup || !curMeta)
     761        return;
     762
     763    QString value = formattedFieldValue(curMeta->ID());
     764    QString whereClause = "WHERE song_id = " + value;
     765    closePlaylistPopup();
     766    updatePlaylistFromQuickPlaylist(whereClause);
     767}
     768
     769void PlaybackBoxMusic::addSelectedtoActive()
     770// adds the currently selected track to the active play queue
     771// stores the currently selected track and reselects it afterwards
     772{
     773    if (!playlist_popup || !curMeta)
     774        return;
     775
     776    // store path to current selection
     777    QStringList branches_to_current_node;
     778    branches_to_current_node = music_tree_list->getRouteToCurrent();
     779               
     780    GenericTree *node = music_tree_list->getCurrentNode();
     781    Metadata *selectedMeta = all_music->getMetadata( node->getInt() );
     782
     783    QString value = formattedFieldValue(selectedMeta->ID());
     784    QString whereClause = "WHERE song_id = " + value;
     785    closePlaylistPopup();
     786    updatePlaylistFromQuickPlaylist(whereClause);
     787   
     788    music_tree_list->tryToSetCurrent(branches_to_current_node);
     789}
     790
    753791void PlaybackBoxMusic::updatePlaylistFromQuickPlaylist(QString whereClause)
    754792{
    755793    doUpdatePlaylist(whereClause);
     
    18171855    playlist_tree->setAttribute(1, 0);
    18181856    playlist_tree->setAttribute(2, 0);
    18191857    playlist_tree->setAttribute(3, 0);
     1858    playlist_tree->setAttribute(4, 0);
    18201859
    18211860    // We ask the playlist object to write out the whole tree (all playlists
    18221861    // and all music). It will set attributes for nodes in the tree, such as
  • mythmusic/mythmusic/playbackbox.h

     
    8989    void byAlbum();
    9090    void byGenre();
    9191    void byYear();
     92    void addPlayingtoActive();
     93    void addSelectedtoActive();
    9294    void fromCD();
    9395    void showSmartPlaylistDialog();
    9496    void showSearchDialog();