示例#1
0
void GlobalSearch::ResultsAvailableSlot(int id,
                                        SearchProvider::ResultList results) {
  if (results.isEmpty()) return;

  // Limit the number of results that are used from each emission.
  // Just a sanity check to stop some providers (Jamendo) returning thousands
  // of results.
  if (results.count() > kMaxResultsPerEmission) {
    SearchProvider::ResultList::iterator begin = results.begin();
    std::advance(begin, kMaxResultsPerEmission);
    results.erase(begin, results.end());
  }

  // Load cached pixmaps into the results
  for (SearchProvider::ResultList::iterator it = results.begin();
       it != results.end(); ++it) {
    it->pixmap_cache_key_ = PixmapCacheKey(*it);
  }

  emit ResultsAvailable(id, results);
}
void GlobalSearchView::AddResults(int id,
                                  const SearchProvider::ResultList& results) {
    if (id != last_search_id_ || results.isEmpty()) return;

    current_model_->AddResults(results);
}