Commit 5aa7f95b authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

port from qforeach to c++ range based loop

parent f5b8a1ea
......@@ -409,7 +409,7 @@ void BacktraceWidget::extraDetailsLinkActivated(QString link)
QString message = QStringLiteral("<html>") + i18n("The packages containing debug information for the following application and libraries are missing:")
+ QStringLiteral("<br /><ul>");
Q_FOREACH (const QString &string, missingDbgForFiles) {
for (const QString &string : std::as_const(missingDbgForFiles)) {
message += QLatin1String("<li>") + string + QLatin1String("</li>");
}
......
......@@ -96,7 +96,7 @@ void ProductMapping::getRelatedProductsUsingInternalFile(const QString &bugzilla
m_relatedBugzillaProducts = QStringList() << m_bugzillaProduct;
// Get related products of each related group
Q_FOREACH (const QString &group, groups) {
for (const QString &group : std::as_const(groups)) {
const KConfigGroup bzGroups = mappingsFile.group("BZGroups");
if (bzGroups.hasKey(group)) {
QString bzGroup = bzGroups.readEntry(group);
......
......@@ -413,7 +413,7 @@ void BugzillaDuplicatesPage::analyzedDuplicates(KJob *j)
if (m_foundDuplicate) {
const QList<QTreeWidgetItem *> items = ui.m_bugListWidget->findItems(QString::number(parentDuplicate), Qt::MatchExactly, 0);
const QBrush brush = KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::NeutralBackground);
Q_FOREACH (QTreeWidgetItem *item, items) {
for (QTreeWidgetItem *item : std::as_const(items)) {
for (int i = 0; i < item->columnCount(); ++i) {
item->setBackground(i, brush);
}
......
......@@ -220,7 +220,7 @@ QString ReportInterface::generateReportFullText(DrKonqiStamp stamp, Backtrace in
if (!m_possibleDuplicates.isEmpty()) {
report.append(QLatin1Char('\n'));
QString duplicatesString;
Q_FOREACH (const QString &dupe, m_possibleDuplicates) {
for (const QString &dupe : std::as_const(m_possibleDuplicates)) {
duplicatesString += QLatin1String("bug ") + dupe + QLatin1String(", ");
}
duplicatesString = duplicatesString.left(duplicatesString.length() - 2) + QLatin1Char('.');
......
......@@ -28,7 +28,7 @@ DebuggerManager::DebuggerManager(const Debugger &internalDebugger, const QList<D
connect(d->btGenerator, &BacktraceGenerator::someError, this, &DebuggerManager::onDebuggerFinished);
connect(d->btGenerator, &BacktraceGenerator::failedToStart, this, &DebuggerManager::onDebuggerFinished);
foreach (const Debugger &debugger, externalDebuggers) {
for (const Debugger &debugger : std::as_const(externalDebuggers)) {
if (debugger.isInstalled()) {
// TODO: use TerminalDebuggerLauncher instead
addDebugger(new DefaultDebuggerLauncher(debugger, this));
......
......@@ -178,7 +178,7 @@ DebuggerManager *KCrashBackend::constructDebuggerManager()
#endif
Debugger firstKnownGoodDebugger, preferredDebugger;
foreach (const Debugger &debugger, internalDebuggers) {
for (const Debugger &debugger : std::as_const(internalDebuggers)) {
qCDebug(DRKONQI_LOG) << "Check debugger if" << debugger.displayName() << "[" << debugger.codeName() << "]"
<< "is installed:" << debugger.isInstalled();
if (!firstKnownGoodDebugger.isValid() && debugger.isInstalled()) {
......
......@@ -192,7 +192,7 @@ void DrKonqiDialog::buildDialogButtons()
// Only add the debugger if requested by the config or if a KDevelop session is running.
const bool showExternal = debuggerManager->showExternalDebuggers();
QList<AbstractDebuggerLauncher *> debuggers = debuggerManager->availableExternalDebuggers();
foreach (AbstractDebuggerLauncher *launcher, debuggers) {
for (AbstractDebuggerLauncher *launcher : std::as_const(debuggers)) {
if (showExternal || qobject_cast<DBusInterfaceLauncher *>(launcher)) {
addDebugger(launcher);
}
......
......@@ -25,10 +25,10 @@ void BacktraceParserTest::fetchData(const QString &group)
QTest::addColumn<bool>("compositorCrash");
m_settings.beginGroup(group);
QStringList keys = m_settings.allKeys();
const QStringList keys = m_settings.allKeys();
m_settings.endGroup();
foreach (const QString &key, keys) {
for (const QString &key : keys) {
QTest::newRow(qPrintable(key)) << QString(DATA_DIR + QLatin1Char('/') + key) << m_settings.value(group + QLatin1Char('/') + key).toString()
<< m_settings.value(QStringLiteral("debugger/") + key).toString()
<< m_settings.value(QStringLiteral("compositorCrash/") + key).toBool();
......@@ -87,8 +87,8 @@ void BacktraceParserTest::btParserBenchmark_data()
QTest::addColumn<QString>("debugger");
m_settings.beginGroup(QStringLiteral("debugger"));
QStringList keys = m_settings.allKeys();
foreach (const QString &key, keys) {
const QStringList keys = m_settings.allKeys();
for (const QString &key : keys) {
QTest::newRow(qPrintable(key)) << QString(DATA_DIR + QLatin1Char('/') + key) << m_settings.value(key).toString();
}
m_settings.endGroup();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment