コード例 #1
0
ファイル: podcastservice.cpp プロジェクト: Gu1/Clementine
void PodcastService::CopyToDevice(const QModelIndexList& episode_indexes,
                                  const QModelIndexList& podcast_indexes) {
  PodcastEpisode episode_tmp;
  SongList songs;
  PodcastEpisodeList episodes;
  Podcast podcast;
  for (const QModelIndex& index : episode_indexes) {
    episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
    if (episode_tmp.downloaded()) episodes << episode_tmp;
  }

  for (const QModelIndex& podcast : podcast_indexes) {
    for (int i = 0; i < podcast.model()->rowCount(podcast); ++i) {
      const QModelIndex& index = podcast.child(i, 0);
      episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
      if (episode_tmp.downloaded() && !episode_tmp.listened())
        episodes << episode_tmp;
    }
  }
  for (const PodcastEpisode& episode : episodes) {
    podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
    songs.append(episode.ToSong(podcast));
  }

  organise_dialog_->SetDestinationModel(
      app_->device_manager()->connected_devices_model(), true);
  organise_dialog_->SetCopy(true);
  if (organise_dialog_->SetSongs(songs)) organise_dialog_->show();
}
コード例 #2
0
ファイル: podcastservice.cpp プロジェクト: Gu1/Clementine
void PodcastService::CopyToDevice(const PodcastEpisodeList& episodes_list) {
  SongList songs;
  Podcast podcast;
  for (const PodcastEpisode& episode : episodes_list) {
    podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
    songs.append(episode.ToSong(podcast));
  }

  organise_dialog_->SetDestinationModel(
      app_->device_manager()->connected_devices_model(), true);
  organise_dialog_->SetCopy(true);
  if (organise_dialog_->SetSongs(songs)) organise_dialog_->show();
}
コード例 #3
0
void Playlist::removeAllCDTracks(void)
{
    // find the cd tracks
    SongList cdTracks;
    for (int x = 0; x < m_songs.count(); x++)
    {
        if (m_songs.at(x)->isCDTrack())
            cdTracks.append(m_songs.at(x));
    }

    // remove the tracks from our lists
    for (int x = 0; x < cdTracks.count(); x++)
    {
        m_songs.removeAll(cdTracks.at(x));
        m_songMap.remove(cdTracks.at(x)->ID());
        m_shuffledSongs.removeAll(cdTracks.at(x));;
    }

    changed();
}