Additional work in MainWindow for integration with new classes

This commit is contained in:
Cameron Gutman
2018-06-27 22:16:57 -07:00
parent d7d11635a0
commit 1b36071e02
3 changed files with 104 additions and 14 deletions
+26
View File
@@ -189,6 +189,32 @@ void ComputerManager::startPolling()
}
}
QVector<NvComputer*> ComputerManager::getComputers()
{
QReadLocker lock(&m_Lock);
return QVector<NvComputer*>::fromList(m_KnownHosts.values());
}
void ComputerManager::deleteHost(NvComputer* computer)
{
QWriteLocker lock(&m_Lock);
QThread* pollingThread = m_PollThreads[computer->uuid];
if (pollingThread != nullptr) {
pollingThread->requestInterruption();
// We must wait here because we're going to delete computer
// and we can't do that out from underneath the poller.
pollingThread->wait();
}
m_PollThreads.remove(computer->uuid);
m_KnownHosts.remove(computer->uuid);
delete computer;
}
void ComputerManager::stopPollingAsync()
{
QWriteLocker lock(&m_Lock);
+5
View File
@@ -222,6 +222,11 @@ public:
bool addNewHost(QString address, bool mdns);
QVector<NvComputer*> getComputers();
// computer is deleted inside this call
void deleteHost(NvComputer* computer);
signals:
void computerStateChanged(NvComputer* computer);