Commit 7b792569 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent 4d6c48ca
......@@ -15,7 +15,7 @@ QString CTInitializationError::errorMessage() const
void CTInitializationError::setErrorMessage(const QString &errorMessage)
{
this->mError = errorMessage;
mError = errorMessage;
}
bool CTInitializationError::hasErrorMessage() const
......
......@@ -320,7 +320,7 @@ CTSaveStatus CTCron::save()
ctTask->apply();
}
foreach (CTVariable *ctVariable, d->variable) {
for (CTVariable *ctVariable : qAsConst(d->variable)) {
ctVariable->apply();
}
......@@ -359,7 +359,7 @@ bool CTCron::isDirty() const
}
}
foreach (CTVariable *ctVariable, d->variable) {
for (CTVariable *ctVariable : qAsConst(d->variable)) {
if (ctVariable->dirty()) {
return true;
}
......@@ -372,7 +372,7 @@ QString CTCron::path() const
{
QString path;
foreach (CTVariable *ctVariable, d->variable) {
for (CTVariable *ctVariable : qAsConst(d->variable)) {
if (ctVariable->variable == QLatin1String("PATH")) {
path = ctVariable->value;
}
......
......@@ -18,8 +18,7 @@ CTHour::CTHour(const QString &tokStr)
int CTHour::findPeriod() const
{
QList<int> periods;
periods << 2 << 3 << 4 << 6 << 8;
const QList<int> periods{2, 3, 4, 6, 8};
return CTUnit::findPeriod(periods);
}
......
......@@ -224,12 +224,10 @@ QString CTTask::schedulingCronFormat() const
return QStringLiteral("@reboot");
}
QString scheduling;
scheduling += minute.exportUnit() + QLatin1String(" ");
scheduling += hour.exportUnit() + QLatin1String(" ");
scheduling += dayOfMonth.exportUnit() + QLatin1String(" ");
scheduling += month.exportUnit() + QLatin1String(" ");
QString scheduling = minute.exportUnit() + QLatin1Char(' ');
scheduling += hour.exportUnit() + QLatin1Char(' ');
scheduling += dayOfMonth.exportUnit() + QLatin1Char(' ');
scheduling += month.exportUnit() + QLatin1Char(' ');
scheduling += dayOfWeek.exportUnit();
return scheduling;
......
......@@ -25,9 +25,7 @@ CTVariable::CTVariable(const QString &tokenString, const QString &_comment, cons
enabled = true;
}
int spacepos(0);
spacepos = tokStr.indexOf(QRegExp(QLatin1String("[ =]")));
const int spacepos = tokStr.indexOf(QRegExp(QLatin1String("[ =]")));
variable = tokStr.mid(0, spacepos);
value = tokStr.mid(spacepos+1, tokStr.length()-spacepos-1);
......
Markdown is supported
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