Add ability to replace sections in RDCFile

This commit is contained in:
baldurk
2017-11-17 16:30:59 +00:00
parent b1c0de3016
commit 0b899d90b6
7 changed files with 327 additions and 37 deletions
+30 -5
View File
@@ -538,12 +538,29 @@ bool CaptureContext::SaveCaptureTo(const QString &captureFile)
{
if(QFileInfo(GetCaptureFilename()).exists())
{
// QFile::copy won't overwrite, so remove the destination first (the save dialog already
// prompted for overwrite)
QFile::remove(captureFile);
success = QFile::copy(GetCaptureFilename(), captureFile);
if(GetCaptureFilename() == captureFile)
{
success = true;
}
else
{
ICaptureFile *capFile = Replay().GetCaptureFile();
error = tr("Couldn't save to %1").arg(captureFile);
if(capFile)
{
// this will overwrite
success = capFile->CopyFileTo(captureFile.toUtf8().data());
}
else
{
// QFile::copy won't overwrite, so remove the destination first (the save dialog already
// prompted for overwrite)
QFile::remove(captureFile);
success = QFile::copy(GetCaptureFilename(), captureFile);
}
error = tr("Couldn't save to %1").arg(captureFile);
}
}
else
{
@@ -568,9 +585,17 @@ bool CaptureContext::SaveCaptureTo(const QString &captureFile)
return false;
}
// if it was a temporary capture, remove the old instnace
if(m_CaptureTemporary)
QFile::remove(m_CaptureFile);
// Update the filename, and mark that it's local and not temporary now.
m_CaptureFile = captureFile;
m_CaptureLocal = true;
m_CaptureTemporary = false;
Replay().ReopenCaptureFile(captureFile);
return true;
}
+7
View File
@@ -355,6 +355,13 @@ void ReplayManager::PingRemote()
}
}
void ReplayManager::ReopenCaptureFile(const QString &path)
{
if(!m_CaptureFile)
m_CaptureFile = RENDERDOC_OpenCaptureFile();
m_CaptureFile->OpenFile(path.toUtf8().data(), "rdc");
}
uint32_t ReplayManager::ExecuteAndInject(const QString &exe, const QString &workingDir,
const QString &cmdLine,
const QList<EnvironmentModification> &env,
+5
View File
@@ -83,6 +83,11 @@ public:
return m_Remote;
return NULL;
}
// may return NULL if the capture file is not open locally. Consider using ICaptureAccess above to
// work whether local or remote.
ICaptureFile *GetCaptureFile() { return m_CaptureFile; }
void ReopenCaptureFile(const QString &path);
const RemoteHost *CurrentRemote() { return m_RemoteHost; }
uint32_t ExecuteAndInject(const QString &exe, const QString &workingDir, const QString &cmdLine,
const QList<EnvironmentModification> &env, const QString &capturefile,