当前位置: 首页>>代码示例>>C++>>正文


C++ SongList::isEmpty方法代码示例

本文整理汇总了C++中SongList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ SongList::isEmpty方法的具体用法?C++ SongList::isEmpty怎么用?C++ SongList::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SongList的用法示例。


在下文中一共展示了SongList::isEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetNameForNewPlaylist

QString PlaylistManager::GetNameForNewPlaylist(const SongList& songs) {
  if (songs.isEmpty()) {
    return tr("Playlist");
  }

  QSet<QString> artists;
  QSet<QString> albums;

  for (const Song& song : songs) {
    artists << (song.artist().isEmpty() ? tr("Unknown") : song.artist());
    albums << (song.album().isEmpty() ? tr("Unknown") : song.album());

    if (artists.size() > 1) {
      break;
    }
  }

  bool various_artists = artists.size() > 1;

  QString result;
  if (various_artists) {
    result = tr("Various artists");
  } else {
    result = artists.values().first();
  }

  if (!various_artists && albums.size() == 1) {
    result += " - " + albums.toList().first();
  }

  return result;
}
开发者ID:Fat-Zer,项目名称:Clementine,代码行数:32,代码来源:playlistmanager.cpp

示例2: SearchFinished

void SpotifyResolver::SearchFinished(const spotify_pb::SearchResponse& response) {
  QString query_string = QString::fromUtf8(response.request().query().c_str());
  qLog(Debug) << query_string;
  QMap<QString, int>::iterator it = queries_.find(query_string);
  if (it == queries_.end()) {
    return;
  }

  int id = it.value();
  queries_.erase(it);

  SongList songs;
  for (int i = 0; i < response.result_size(); ++i) {
    const spotify_pb::Track& track = response.result(i);
    Song song;
    SpotifyService::SongFromProtobuf(track, &song);
    songs << song;
  }
  qLog(Debug) << "Resolved from spotify:" << songs.length();
  if (!songs.isEmpty()) {
    qLog(Debug) << songs[0].title() << songs[0].artist();
  }

  emit ResolveFinished(id, songs);
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:25,代码来源:spotifyresolver.cpp

示例3: DeleteFinished

void FileView::DeleteFinished(const SongList& songs_with_errors) {
  if (songs_with_errors.isEmpty()) return;

  OrganiseErrorDialog* dialog = new OrganiseErrorDialog(this);
  dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors);
  // It deletes itself when the user closes it
}
开发者ID:ConfusedGiant,项目名称:Clementine,代码行数:7,代码来源:fileview.cpp

示例4: GetMimeDataForAlbums

SongMimeData* AlbumCoverManager::GetMimeDataForAlbums(
    const QModelIndexList& indexes) const {
  SongList songs = GetSongsInAlbums(indexes);
  if (songs.isEmpty()) return nullptr;

  SongMimeData* data = new SongMimeData;
  data->backend = library_backend_;
  data->songs = songs;
  return data;
}
开发者ID:Aceler,项目名称:Clementine,代码行数:10,代码来源:albumcovermanager.cpp

示例5: FetchTag

void EditTagDialog::FetchTag() {
  const QModelIndexList sel =
      ui_->song_list->selectionModel()->selectedIndexes();

  SongList songs;

  for (const QModelIndex& index : sel) {
    Song song = data_[index.row()].original_;
    if (!song.is_valid()) {
      continue;
    }

    songs << song;
  }

  if (songs.isEmpty()) return;

  results_dialog_->Init(songs);
  tag_fetcher_->StartFetch(songs);

  results_dialog_->show();
}
开发者ID:Narfinger,项目名称:Clementine,代码行数:22,代码来源:edittagdialog.cpp

示例6: AlbumIcon

QVariant LibraryModel::AlbumIcon(const QModelIndex& index) {
  LibraryItem* item = IndexToItem(index);
  if (!item) return no_cover_icon_;

  // Check the cache for a pixmap we already loaded.
  const QString cache_key = AlbumIconPixmapCacheKey(index);
  QPixmap cached_pixmap;
  if (QPixmapCache::find(cache_key, &cached_pixmap)) {
    return cached_pixmap;
  }

  // Try to load it from the disk cache
  std::unique_ptr<QIODevice> cache(icon_cache_->data(QUrl(cache_key)));
  if (cache) {
    QImage cached_pixmap;
    if (cached_pixmap.load(cache.get(), "XPM")) {
      QPixmapCache::insert(cache_key, QPixmap::fromImage(cached_pixmap));
      return QPixmap::fromImage(cached_pixmap);
    }
  }

  // Maybe we're loading a pixmap already?
  if (pending_cache_keys_.contains(cache_key)) {
    return no_cover_icon_;
  }

  // No art is cached and we're not loading it already.  Load art for the first
  // Song in the album.
  SongList songs = GetChildSongs(index);
  if (!songs.isEmpty()) {
    const quint64 id = app_->album_cover_loader()->LoadImageAsync(
        cover_loader_options_, songs.first());
    pending_art_[id] = ItemAndCacheKey(item, cache_key);
    pending_cache_keys_.insert(cache_key);
  }

  return no_cover_icon_;
}
开发者ID:minneyar,项目名称:Clementine,代码行数:38,代码来源:librarymodel.cpp

示例7: SaveFocus

void LibraryView::SaveFocus() {
  QModelIndex current = currentIndex();
  QVariant type = model()->data(current, LibraryModel::Role_Type);
  if (!type.isValid() || !(type.toInt() == LibraryItem::Type_Song ||
                           type.toInt() == LibraryItem::Type_Container ||
                           type.toInt() == LibraryItem::Type_Divider)) {
    return;
  }

  last_selected_path_.clear();
  last_selected_song_ = Song();
  last_selected_container_ = QString();

  switch (type.toInt()) {
    case LibraryItem::Type_Song: {
      QModelIndex index =
          qobject_cast<QSortFilterProxyModel*>(model())->mapToSource(current);
      SongList songs = app_->library_model()->GetChildSongs(index);
      if (!songs.isEmpty()) {
        last_selected_song_ = songs.last();
      }
      break;
    }

    case LibraryItem::Type_Container:
    case LibraryItem::Type_Divider: {
      QString text =
          model()->data(current, LibraryModel::Role_SortText).toString();
      last_selected_container_ = text;
      break;
    }

    default:
      return;
  }

  SaveContainerPath(current);
}
开发者ID:Aceler,项目名称:Clementine,代码行数:38,代码来源:libraryview.cpp


注:本文中的SongList::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。