Manager: Refactor the machine process stats system

and the statusbar text generation
This commit is contained in:
Alexander Babikov
2025-08-13 23:35:31 +05:00
parent babdab5eb7
commit 7167f76170
31 changed files with 350 additions and 112 deletions

View File

@@ -167,15 +167,12 @@ VMManagerModel::updateDisplayName(const QModelIndex &index, const QString &newDi
machines.at(index.row())->setDisplayName(newDisplayName);
modelDataChanged();
}
QHash<QString, int>
QMap<VMManagerSystem::ProcessStatus, int>
VMManagerModel::getProcessStats()
{
QHash<QString, int> stats;
QMap<VMManagerSystem::ProcessStatus, int> stats;
for (const auto& system: machines) {
if (system->getProcessStatus() != VMManagerSystem::ProcessStatus::Stopped) {
auto statusString = system->getProcessStatusString();
stats[statusString] += 1;
}
stats[system->getProcessStatus()] += 1;
}
return stats;
}