Qt: Add API wrapper for VFileMemChunk
Vicki Pfau vi@endrift.com
Tue, 08 Dec 2020 19:37:13 -0800
4 files changed,
9 insertions(+),
3 deletions(-)
M
src/platform/qt/CoreController.cpp
→
src/platform/qt/CoreController.cpp
@@ -499,7 +499,7 @@ }
mCoreThreadRunFunction(&m_threadContext, [](mCoreThread* context) { CoreController* controller = static_cast<CoreController*>(context->userData); if (!controller->m_backupLoadState.isOpen()) { - controller->m_backupLoadState = VFileMemChunk(nullptr, 0); + controller->m_backupLoadState = VFileDevice::openMemory(); } mCoreSaveStateNamed(context->core, controller->m_backupLoadState, controller->m_saveStateFlags); if (mCoreLoadState(context->core, controller->m_stateSlot, controller->m_loadStateFlags)) {@@ -518,7 +518,7 @@ if (!vf) {
return; } if (!controller->m_backupLoadState.isOpen()) { - controller->m_backupLoadState = VFileMemChunk(nullptr, 0); + controller->m_backupLoadState = VFileDevice::openMemory(); } mCoreSaveStateNamed(context->core, controller->m_backupLoadState, controller->m_saveStateFlags); if (mCoreLoadStateNamed(context->core, vf, controller->m_loadStateFlags)) {
M
src/platform/qt/FrameView.cpp
→
src/platform/qt/FrameView.cpp
@@ -518,7 +518,7 @@
void FrameView::refreshVl() { QMutexLocker locker(&m_mutex); m_currentFrame = m_nextFrame; - m_nextFrame = VFileMemChunk(nullptr, 0); + m_nextFrame = VFileDevice::openMemory(); if (m_currentFrame) { m_controller->endVideoLog(false); QMetaObject::invokeMethod(this, "newVl");
M
src/platform/qt/VFileDevice.cpp
→
src/platform/qt/VFileDevice.cpp
@@ -78,9 +78,14 @@ VFile* VFileDevice::open(const QString& path, int mode) {
return VFileOpen(path.toUtf8().constData(), mode); } +VFile* VFileDevice::openMemory() { + return VFileMemChunk(nullptr, 0); +} + VDir* VFileDevice::openDir(const QString& path) { return VDirOpen(path.toUtf8().constData()); } + VDir* VFileDevice::openArchive(const QString& path) { return VDirOpenArchive(path.toUtf8().constData()); }
M
src/platform/qt/VFileDevice.h
→
src/platform/qt/VFileDevice.h
@@ -29,6 +29,7 @@ VFileDevice& operator=(VFile*);
operator VFile*() { return m_vf; } static VFile* open(const QString& path, int mode); + static VFile* openMemory(); static VDir* openDir(const QString& path); static VDir* openArchive(const QString& path);