MCPcopy Create free account
hub / github.com/baldurk/renderdoc / refreshHost

Method refreshHost

qrenderdoc/Windows/Dialogs/RemoteManager.cpp:214–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void RemoteManager::refreshHost(RDTreeWidgetItem *node)
215{
216 RemoteHost host = getRemoteHost(node);
217
218 if(!host.IsValid())
219 return;
220
221 m_Lookups.release();
222
223 // this function looks up the remote connections and for each one open
224 // queries it for the API, target (usually executable name) and if any user is already connected
225 LambdaThread *th = new LambdaThread([this, node, h = host]() {
226 QByteArray username = GetSystemUsername().toUtf8();
227
228 // make a mutable copy and check the status
229 RemoteHost host = h;
230 host.CheckStatus();
231
232 GUIInvoke::call(this, [this, node, host]() {
233 setRemoteServerLive(node, host.IsServerRunning(), host.IsBusy());
234 });
235
236 uint32_t nextIdent = 0;
237
238 for(;;)
239 {
240 // just a sanity check to make sure we don't hit some unexpected case and infinite loop
241 uint32_t prevIdent = nextIdent;
242
243 nextIdent = RENDERDOC_EnumerateRemoteTargets(host.Hostname(), nextIdent);
244
245 if(nextIdent == 0 || prevIdent >= nextIdent)
246 break;
247
248 ITargetControl *conn =
249 RENDERDOC_CreateTargetControl(host.Hostname(), nextIdent, username.data(), false);
250
251 if(conn)
252 {
253 QString target = conn->GetTarget();
254 QString api = conn->GetAPI();
255 QString busy = conn->GetBusyClient();
256
257 QString running;
258
259 if(!busy.isEmpty())
260 running = tr("Running %1, %2 is connected").arg(api).arg(busy);
261 else
262 running = tr("Running %1").arg(api);
263
264 RemoteConnect tag(host.Hostname(), host.Name(), nextIdent);
265
266 GUIInvoke::call(this, [this, node, target, running, tag]() {
267 RDTreeWidgetItem *child = new RDTreeWidgetItem({target, running});
268 setRemoteConnect(child, tag);
269 node->addChild(child);
270 ui->hosts->expandItem(node);
271 });

Callers

nothing calls this directly

Calls 15

GetSystemUsernameFunction · 0.85
setRemoteConnectFunction · 0.85
toUtf8Method · 0.80
GetTargetMethod · 0.80
GetAPIMethod · 0.80
GetBusyClientMethod · 0.80
NameMethod · 0.80
expandItemMethod · 0.80
selfDeleteMethod · 0.80
trFunction · 0.50

Tested by

no test coverage detected