Change by-ref passed float or bool parameters to callbacks in public API

* Mostly used for passing a progress float back during a long blocking
  call like opening a capture or doing a copy.
* This is much more feasible for python to bind to.
* In several cases we just use a tiny lambda that updates a float anyway
  since we can't push the progress directly into a progress dialog, but
  need to let it query from a temporary in-between float.
This commit is contained in:
baldurk
2018-01-01 14:56:10 +00:00
parent 2e74989b69
commit 7a2305ae31
24 changed files with 212 additions and 154 deletions
+7 -6
View File
@@ -42,7 +42,7 @@ ReplayManager::~ReplayManager()
RENDERDOC_UnregisterMemoryRegion(this);
}
void ReplayManager::OpenCapture(const QString &capturefile, float *progress)
void ReplayManager::OpenCapture(const QString &capturefile, RENDERDOC_ProgressCallback progress)
{
if(m_Running)
return;
@@ -50,8 +50,6 @@ void ReplayManager::OpenCapture(const QString &capturefile, float *progress)
// TODO maybe we could expose this choice to the user?
int proxyRenderer = -1;
*progress = 0.0f;
m_Thread = new LambdaThread([this, proxyRenderer, capturefile, progress]() {
run(proxyRenderer, capturefile, progress);
});
@@ -171,7 +169,8 @@ rdcstr ReplayManager::CopyCaptureToRemote(const rdcstr &localpath, QWidget *wind
auto lambda = [this, localpath, &remotepath, &progress, &copied](IReplayController *r) {
QMutexLocker autolock(&m_RemoteLock);
remotepath = m_Remote->CopyCaptureToRemote(localpath.c_str(), &progress);
remotepath =
m_Remote->CopyCaptureToRemote(localpath.c_str(), [&progress](float p) { progress = p; });
copied = true;
};
@@ -204,7 +203,8 @@ void ReplayManager::CopyCaptureFromRemote(const rdcstr &remotepath, const rdcstr
auto lambda = [this, localpath, remotepath, &progress, &copied](IReplayController *r) {
QMutexLocker autolock(&m_RemoteLock);
m_Remote->CopyCaptureFromRemote(remotepath.c_str(), localpath.c_str(), &progress);
m_Remote->CopyCaptureFromRemote(remotepath.c_str(), localpath.c_str(),
[&progress](float p) { progress = p; });
copied = true;
};
@@ -408,7 +408,8 @@ void ReplayManager::PushInvoke(ReplayManager::InvokeHandle *cmd)
m_RenderCondition.wakeAll();
}
void ReplayManager::run(int proxyRenderer, const QString &capturefile, float *progress)
void ReplayManager::run(int proxyRenderer, const QString &capturefile,
RENDERDOC_ProgressCallback progress)
{
m_Renderer = NULL;