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

Method on_connect_clicked

qrenderdoc/Windows/Dialogs/RemoteManager.cpp:573–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void RemoteManager::on_connect_clicked()
574{
575 RDTreeWidgetItem *node = ui->hosts->selectedItem();
576
577 if(!node)
578 return;
579
580 RemoteConnect connect = getRemoteConnect(node);
581 RemoteHost host = getRemoteHost(node);
582
583 if(connect.ident > 0)
584 {
585 connectToApp(node);
586 }
587 else if(host.IsValid())
588 {
589 if(host.IsServerRunning())
590 {
591 QMessageBox::StandardButton res = RDDialog::question(
592 this, tr("Remote server shutdown"),
593 tr("Are you sure you wish to shut down running remote server on %1?").arg(host.Name()),
594 RDDialog::YesNoCancel);
595
596 if(res == QMessageBox::Cancel || res == QMessageBox::No)
597 return;
598
599 // shut down
600 if(host.IsConnected())
601 {
602 m_Ctx.Replay().ShutdownServer();
603 setRemoteServerLive(node, false, false);
604 }
605 else
606 {
607 ResultDetails result = {ResultCode::Succeeded};
608 LambdaThread *th = new LambdaThread([&host, &result]() {
609 IRemoteServer *server = NULL;
610 result = host.Connect(&server);
611 if(server)
612 server->ShutdownServerAndConnection();
613 });
614 th->start();
615 th->wait(500);
616 if(th->isRunning())
617 {
618 ShowProgressDialog(this, tr("Shutting down server, please wait..."),
619 [th]() { return !th->isRunning(); });
620 }
621 th->deleteLater();
622
623 setRemoteServerLive(node, false, false);
624
625 if(!result.OK())
626 RDDialog::critical(this, tr("Shutdown error"),
627 tr("Error shutting down remote server: %1").arg(result.Message()));
628 }
629
630 // kick off a thread to check the status

Callers

nothing calls this directly

Calls 15

getRemoteConnectFunction · 0.85
questionFunction · 0.85
ShowProgressDialogFunction · 0.85
criticalFunction · 0.85
selectedItemMethod · 0.80
NameMethod · 0.80
ShutdownServerMethod · 0.80
selfDeleteMethod · 0.80
trFunction · 0.50
IsValidMethod · 0.45
IsServerRunningMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected