Move PIN generation into ComputerManager to be shared with CLI pairing
This commit is contained in:
parent
f4acd629a1
commit
692942e5be
3 changed files with 15 additions and 8 deletions
|
|
@ -10,6 +10,8 @@
|
|||
#include <QThreadPool>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <random>
|
||||
|
||||
#define SER_HOSTS "hosts"
|
||||
|
||||
class PcMonitorThread : public QThread
|
||||
|
|
@ -826,4 +828,14 @@ void ComputerManager::addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv
|
|||
QThreadPool::globalInstance()->start(addTask);
|
||||
}
|
||||
|
||||
// TODO: Use QRandomGenerator when we drop Qt 5.9 support
|
||||
QString ComputerManager::generatePinString()
|
||||
{
|
||||
std::uniform_int_distribution<int> dist(0, 9999);
|
||||
std::random_device rd;
|
||||
std::mt19937 engine(rd());
|
||||
|
||||
return QString::asprintf("%04u", dist(engine));
|
||||
}
|
||||
|
||||
#include "computermanager.moc"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue