refactor: ServerConfig: used ranged loop to process neighbours
This commit is contained in:
parent
d321e2a874
commit
048ce47008
1 changed files with 11 additions and 8 deletions
|
|
@ -246,15 +246,18 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||||
|
|
||||||
outStream << "section: links" << Qt::endl;
|
outStream << "section: links" << Qt::endl;
|
||||||
|
|
||||||
for (int i = 0; i < config.screens().size(); i++) {
|
for (int i = 0; const auto &screen : config.screens()) {
|
||||||
if (!config.screens()[i].isNull()) {
|
if (screen.isNull()) {
|
||||||
outStream << "\t" << config.screens()[i].name() << ":" << Qt::endl;
|
i++;
|
||||||
for (unsigned int j = 0; j < std::size(neighbourDirs); j++) {
|
continue;
|
||||||
int idx = config.adjacentScreenIndex(i, neighbourDirs[j].x, neighbourDirs[j].y);
|
|
||||||
if (idx != -1 && !config.screens()[idx].isNull())
|
|
||||||
outStream << "\t\t" << neighbourDirs[j].name << " = " << config.screens()[idx].name() << Qt::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
outStream << "\t" << screen.name() << ":\n";
|
||||||
|
for (const auto &neighbour : std::as_const(neighbourDirs)) {
|
||||||
|
int idx = config.adjacentScreenIndex(i, neighbour.x, neighbour.y);
|
||||||
|
if (idx != -1 && !config.screens()[idx].isNull())
|
||||||
|
outStream << "\t\t" << neighbour.name << " = " << config.screens()[idx].name() << Qt::endl;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
outStream << "end" << Qt::endl << Qt::endl;
|
outStream << "end" << Qt::endl << Qt::endl;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue