18 #include <QStringList>
21 #include "../util/btassert.h"
26 #include <installmgr.h>
33 qWarning(
"InstallMgr: getting remote list returned an error.");
42 auto const sourceCount = sourceNames.count();
44 auto const failedSources(std::make_unique<
int[]>(sourceCount));
45 std::size_t numFailedSources = 0u;
47 for (
int i = 0; i < sourceCount; ++i) {
52 QString
const & sourceName = sourceNames[i];
54 tr(
"Updating remote library \"%1\"").arg(sourceName));
57 if (iMgr.refreshRemoteSource(&
source)) {
58 failedSources[numFailedSources] = i;
63 static_cast<int>(10 + 90 * ((i + 1.0) / sourceCount)));
66 if (numFailedSources <= 0) {
67 Q_EMIT
showMessage(tr(
"Remote libraries have been updated."));
70 QString msg = tr(
"The following remote libraries failed to update: ");
71 for (std::size_t i = 0;;) {
72 msg += sourceNames[failedSources[i]];
73 if (++i >= numFailedSources)
75 static auto const separator = QStringLiteral(
", ");
76 msg.append(separator);
std::atomic< bool > m_finishedSuccessfully
void percentComplete(int percent)
void showMessage(QString const &msg)
bool shouldStop() const noexcept
sword::InstallSource source(const QString &name)
QStringList sourceNameList()