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

Method OnCaptureTrigger

qrenderdoc/Windows/MainWindow.cpp:710–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710void MainWindow::OnCaptureTrigger(const QString &exe, const QString &workingDir,
711 const QString &cmdLine,
712 const rdcarray<EnvironmentModification> &env, CaptureOptions opts,
713 std::function<void(LiveCapture *)> callback)
714{
715 if(!PromptCloseCapture())
716 return;
717
718 LambdaThread *th = new LambdaThread([this, exe, workingDir, cmdLine, env, opts, callback]() {
719 if(isUnshareableDeviceInUse())
720 {
721 RDDialog::warning(this, tr("RenderDoc is already capturing an app on this device"),
722 tr("A running app on this device is already being captured with RenderDoc. "
723 "First please close the app then try to launch again."),
724 QMessageBox::Ok);
725 return;
726 }
727
728 QString capturefile = m_Ctx.TempCaptureFilename(QFileInfo(exe).baseName());
729
730 ExecuteResult ret =
731 m_Ctx.Replay().ExecuteAndInject(exe, workingDir, cmdLine, env, capturefile, opts);
732
733 GUIInvoke::call(this, [this, exe, ret, callback]() {
734 if(ret.result.code == ResultCode::JDWPFailure)
735 {
736 RDDialog::critical(
737 this, tr("Error connecting to debugger"),
738 tr("<html>Error launching %1 for capture.\n\n"
739 "Something went wrong connecting to the debugger on the Android device.\n\n"
740 "This can happen if the package is not marked as debuggable, the device is not "
741 "configured to allow app debugging, if the intent arguments are badly specified, or "
742 "if another android tool such as Android Studio is interfering with the debug "
743 "connection.\n\n"
744 "Close <b>all</b> instances of Android Studio or other Android programs "
745 "and try again.</html>")
746 .arg(exe));
747 return;
748 }
749
750 if(ret.result.code != ResultCode::Succeeded)
751 {
752 RDDialog::critical(
753 this, tr("Error launching capture"),
754 tr("Error launching %1 for capture.\n\n%2").arg(exe).arg(ret.result.Message()));
755 return;
756 }
757
758 LiveCapture *live = new LiveCapture(
759 m_Ctx,
760 m_Ctx.Replay().CurrentRemote().IsValid() ? m_Ctx.Replay().CurrentRemote().Hostname() : "",
761 m_Ctx.Replay().CurrentRemote().IsValid() ? m_Ctx.Replay().CurrentRemote().Name() : "",
762 ret.ident, this, this);
763 ShowLiveCapture(live);
764 callback(live);
765 });
766 });
767 th->setName(lit("ExecuteAndInject"));

Callers 1

GetCaptureDialogMethod · 0.80

Calls 15

criticalFunction · 0.85
ShowProgressDialogFunction · 0.85
CurrentRemoteMethod · 0.80
NameMethod · 0.80
fileNameMethod · 0.80
warningFunction · 0.50
trFunction · 0.50
QFileInfoClass · 0.50
TempCaptureFilenameMethod · 0.45
ExecuteAndInjectMethod · 0.45
argMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected