Sort the host list

This commit is contained in:
Cameron Gutman 2023-09-03 16:20:29 -05:00
parent 94d821a4a9
commit d165bf7498

View file

@ -450,7 +450,12 @@ QVector<NvComputer*> ComputerManager::getComputers()
{
QReadLocker lock(&m_Lock);
return QVector<NvComputer*>::fromList(m_KnownHosts.values());
// Return a sorted host list
auto hosts = QVector<NvComputer*>::fromList(m_KnownHosts.values());
std::stable_sort(hosts.begin(), hosts.end(), [](const NvComputer* host1, const NvComputer* host2) {
return host1->name.toLower() < host2->name.toLower();
});
return hosts;
}
class DeferredHostDeletionTask : public QRunnable