Commit 36ee884c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent 84c2c48b
......@@ -36,7 +36,6 @@ Analyzer::Analyzer(LogMode *mode)
, logMode(mode)
, insertionLocking(QMutex::Recursive)
{
parsingPaused = false;
}
Analyzer::~Analyzer()
......
......@@ -80,7 +80,7 @@ Q_SIGNALS:
protected:
void informOpeningProgress(int currentPosition, int total);
bool parsingPaused;
bool parsingPaused = false;
LogViewModel *logViewModel = nullptr;
LogMode *const logMode;
QMutex insertionLocking;
......
......@@ -181,9 +181,9 @@ int FileAnalyzer::insertLines(const QStringList &bufferedLines, const LogFile &l
int insertedLogLineCount = 0;
while (currentPosition < bufferedLines.size()) {
QString buffer(it.next());
const QString buffer(it.next());
bool inserted = insertLine(buffer, logFile, readingMode);
const bool inserted = insertLine(buffer, logFile, readingMode);
if (inserted) {
insertedLogLineCount++;
}
......
......@@ -277,7 +277,7 @@ void Globals::recreateLogModeActions()
}
}
QList<LogModeAction *> Globals::logModeActions()
QList<LogModeAction *> Globals::logModeActions() const
{
return d->logModeActions;
}
......@@ -90,7 +90,7 @@ public:
QList<LogMode *> logModes() const;
QList<LogModeAction *> logModeActions();
QList<LogModeAction *> logModeActions() const;
LogMode *findLogMode(const QString &logModeName);
......
......@@ -58,8 +58,9 @@ LevelPrintPage::LevelPrintPage(QWidget *parent)
*/
int row = 0, col = 0;
const auto logLevels = Globals::instance().logLevels();
foreach (LogLevel *level, Globals::instance().logLevels()) {
for (LogLevel *level : logLevels) {
QCheckBox *button = new QCheckBox(level->name()); //, m_btnGroup, 0
levelCheckBoxes.append(button);
......
......@@ -90,7 +90,7 @@ void LocalLogFileReader::watchFile(bool enable)
if (enable) {
logDebug() << "Monitoring file : " << filePath;
if (d->watch->contains(filePath) == false) {
if (!d->watch->contains(filePath)) {
d->watch->addFile(filePath);
}
......
......@@ -75,7 +75,7 @@ View *LogManager::usedView() const
void LogManager::reload()
{
if (d->logMode == nullptr) {
if (!d->logMode) {
logWarning() << "Log manager is not yet initialized";
return;
}
......
......@@ -85,9 +85,9 @@ TabLogViewsWidget::TabLogViewsWidget(QWidget *parent)
TabLogViewsWidget::~TabLogViewsWidget()
{
QList<TabLogManager *> copy = d->tabLogManagers;
const QList<TabLogManager *> copy = d->tabLogManagers;
foreach (TabLogManager *tabLogManager, copy) {
for (TabLogManager *tabLogManager : copy) {
d->tabLogManagers.removeAll(tabLogManager);
delete tabLogManager;
}
......@@ -117,6 +117,7 @@ QList<LogManager *> TabLogViewsWidget::logManagers()
{
QList<LogManager *> logManagers;
const auto tabLogManagers = d->tabLogManagers;
logManagers.reserve(tabLogManagers.count());
for (TabLogManager *tabLogManager : tabLogManagers) {
logManagers.append(tabLogManager->logManager());
}
......@@ -298,7 +299,8 @@ void TabLogViewsWidget::reloadAll()
{
logDebug() << "Reloading all tabs...";
foreach (TabLogManager *tabLogManager, d->tabLogManagers) {
const auto tabLogManagers = d->tabLogManagers;
for (TabLogManager *tabLogManager : tabLogManagers) {
// Log manager without log mode does not need to be reloaded
if (tabLogManager->logManager()->logMode() == nullptr) {
continue;
......
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