Expose capture connection windows to python scripting

This commit is contained in:
baldurk
2026-08-13 17:46:46 +01:00
parent 7806d1557d
commit db75eec620
10 changed files with 581 additions and 117 deletions
+17 -12
View File
@@ -35,7 +35,6 @@
#include "Windows/MainWindow.h"
#include "flowlayout/FlowLayout.h"
#include "toolwindowmanager/ToolWindowManager.h"
#include "LiveCapture.h"
#include "ui_CaptureDialog.h"
#define JSON_ID "rdocCaptureSettings"
@@ -1168,8 +1167,9 @@ void CaptureDialog::SetEnvironmentModifications(const rdcarray<EnvironmentModifi
ui->envVar->setText(envModText);
}
void CaptureDialog::Launch()
ICaptureConnection *CaptureDialog::Launch()
{
ICaptureConnection *ret = NULL;
if(IsInjectMode())
{
QModelIndexList sel = ui->processList->selectionModel()->selectedRows();
@@ -1184,11 +1184,13 @@ void CaptureDialog::Launch()
QString name = m_ProcessModel->data(m_ProcessModel->index(item.row(), 0)).toString();
uint32_t PID = m_ProcessModel->data(m_ProcessModel->index(item.row(), 1)).toUInt();
m_InjectCallback(
PID, Settings().environment, name, Settings().options, [this](LiveCapture *live) {
if(ui->queueFrameCap->isChecked())
live->QueueCapture((int)ui->queuedFrame->value(), (int)ui->numFrames->value());
});
m_InjectCallback(PID, Settings().environment, name, Settings().options,
[this, &ret](ICaptureConnection *live) {
if(ui->queueFrameCap->isChecked())
live->QueueCapture((int)ui->queuedFrame->value(),
(int)ui->numFrames->value());
ret = live;
});
}
else
{
@@ -1205,7 +1207,7 @@ void CaptureDialog::Launch()
RDDialog::critical(this, tr("No executable selected"),
tr("No program selected to launch, click browse next to 'Executable Path' "
"above to select the program to launch."));
return;
return NULL;
}
// for non-remote captures, check the executable locally
@@ -1217,7 +1219,7 @@ void CaptureDialog::Launch()
this, tr("Invalid executable"),
tr("Invalid executable: %1\nCan't locate this path or a matching executable in PATH")
.arg(exe));
return;
return NULL;
}
}
@@ -1231,7 +1233,7 @@ void CaptureDialog::Launch()
RDDialog::critical(
this, tr("Invalid working directory"),
tr("Invalid working directory: %1\nThis path does not exist").arg(workingDir));
return;
return NULL;
}
}
@@ -1253,15 +1255,18 @@ void CaptureDialog::Launch()
"The intent arguments must include the full parameters e.g. "
"--es args \"my arguments\"")
.arg(cmdLine));
return;
return NULL;
}
}
m_CaptureCallback(exe, workingDir, cmdLine, Settings().environment, Settings().options,
[this](LiveCapture *live) {
[this, &ret](ICaptureConnection *live) {
if(ui->queueFrameCap->isChecked())
live->QueueCapture((int)ui->queuedFrame->value(),
(int)ui->numFrames->value());
ret = live;
});
}
return ret;
}