MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / refreshRepositories

Method refreshRepositories

app/src/Misc/ExtensionManager.cpp:386–437  ·  view source on GitHub ↗

* @brief Fetches manifest.json from each configured repository and merges * the results into the extension catalog. */

Source from the content-addressed store, hash-verified

384 * the results into the extension catalog.
385 */
386void Misc::ExtensionManager::refreshRepositories()
387{
388 if (m_loading)
389 return;
390
391 for (auto* reply : std::as_const(m_activeReplies)) {
392 if (reply) {
393 reply->disconnect(this);
394 reply->abort();
395 reply->deleteLater();
396 }
397 }
398
399 m_activeReplies.clear();
400
401 m_allExtensions = QJsonArray();
402 m_filteredExtensions.clear();
403 m_selectedIndex = -1;
404 m_pendingManifests = 0;
405 m_pendingExtensionMetas = 0;
406 Q_EMIT selectedIndexChanged();
407 Q_EMIT filteredExtensionsChanged();
408
409 QStringList remoteRepos;
410 QStringList localRepos;
411 for (const auto& repo : std::as_const(m_repositories))
412 if (isLocalRepo(repo))
413 localRepos.append(repo);
414 else
415 remoteRepos.append(repo);
416
417 for (const auto& localPath : std::as_const(localRepos))
418 loadLocalManifest(localPath);
419
420 m_pendingManifests = remoteRepos.count();
421 if (m_pendingManifests > 0) {
422 m_loading = true;
423 Q_EMIT loadingChanged();
424
425 for (const auto& repoUrl : std::as_const(remoteRepos)) {
426 auto* reply = m_nam.get(QNetworkRequest(QUrl(repoUrl)));
427 reply->setProperty("repoUrl", repoUrl);
428 m_activeReplies.insert(reply);
429 connect(reply, &QNetworkReply::finished, this, &ExtensionManager::onManifestReply);
430 }
431 }
432
433 else {
434 applyFilter();
435 rebuildInstalledPlugins();
436 }
437}
438
439/**
440 * @brief Adds a new repository URL and persists the list.

Callers 1

Calls 7

QUrlClass · 0.50
disconnectMethod · 0.45
abortMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45
countMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected