Restore image auto-update on change feature

* This was apparently never ported over to Qt!
This commit is contained in:
baldurk
2021-01-18 13:22:36 +00:00
parent 84dabc7b54
commit 2070e74cf1
2 changed files with 21 additions and 0 deletions
+17
View File
@@ -28,6 +28,7 @@
#include <QDirIterator>
#include <QElapsedTimer>
#include <QFileInfo>
#include <QFileSystemWatcher>
#include <QLabel>
#include <QMenu>
#include <QMessageBox>
@@ -732,6 +733,19 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const ReplayOptions
[this]() { return !m_LoadInProgress; },
[this]() { return UpdateLoadProgress(); });
if(local)
{
m_Watcher = new QFileSystemWatcher({captureFile}, GetMainWindow()->Widget());
QObject::connect(m_Watcher, &QFileSystemWatcher::fileChanged, [this]() {
Replay().AsyncInvoke([this](IReplayController *r) {
r->FileChanged();
r->SetFrameEvent(m_EventID, true);
GUIInvoke::call(GetMainWindow()->Widget(), [this]() { RefreshUIStatus({}, true, true); });
});
});
}
#if defined(RELEASE)
ANALYTIC_ADDAVG(Performance.LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9));
#endif
@@ -1274,6 +1288,9 @@ void CaptureContext::CloseCapture()
if(!m_CaptureLoaded)
return;
delete m_Watcher;
m_Watcher = NULL;
delete m_RGP;
m_RGP = NULL;
+4
View File
@@ -55,6 +55,8 @@ class ResourceInspector;
class ShaderViewer;
class MiniQtHelper;
class QFileSystemWatcher;
class CaptureContext : public ICaptureContext, IExtensionManager
{
Q_DECLARE_TR_FUNCTIONS(CaptureContext);
@@ -405,6 +407,8 @@ private:
MiniQtHelper *m_QtHelper = NULL;
QFileSystemWatcher *m_Watcher = NULL;
// Windows
MainWindow *m_MainWindow = NULL;
EventBrowser *m_EventBrowser = NULL;