QGraphicsFrameCapture : Add getters for frames names
Save captured frames names and add getters for them Change-Id: I429e1512d6610ade9414f59fee3d081548cbb2ab Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> (cherry picked from commit 564efa3741ccd21b03d95a778e7a37d5bd902e53) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
83df3a8138
commit
bf77adf1b0
@ -82,6 +82,22 @@ void QGraphicsFrameCapture::setCapturePrefix(const QString &prefix)
|
|||||||
d->setCapturePrefix(prefix);
|
d->setCapturePrefix(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QGraphicsFrameCapture::capturedFileName()
|
||||||
|
{
|
||||||
|
if (!d.isNull())
|
||||||
|
return d->capturedFileName();
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QGraphicsFrameCapture::capturedFilesNames()
|
||||||
|
{
|
||||||
|
if (!d.isNull())
|
||||||
|
return d->capturedFilesNames();
|
||||||
|
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
bool QGraphicsFrameCapture::isLoaded() const
|
bool QGraphicsFrameCapture::isLoaded() const
|
||||||
{
|
{
|
||||||
if (!d.isNull())
|
if (!d.isNull())
|
||||||
|
@ -39,6 +39,9 @@ public:
|
|||||||
QString capturePrefix() const;
|
QString capturePrefix() const;
|
||||||
void setCapturePrefix(const QString &prefix);
|
void setCapturePrefix(const QString &prefix);
|
||||||
|
|
||||||
|
QString capturedFileName();
|
||||||
|
QStringList capturedFilesNames();
|
||||||
|
|
||||||
bool isLoaded() const;
|
bool isLoaded() const;
|
||||||
bool isCapturing() const;
|
bool isCapturing() const;
|
||||||
void openCapture() const;
|
void openCapture() const;
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
#include <QtCore/qnamespace.h>
|
#include <QtCore/qnamespace.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
#include <QtCore/qstringlist.h>
|
||||||
class QRhi;
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -27,6 +26,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcGraphicsFrameCapture)
|
|||||||
|
|
||||||
class QRhi;
|
class QRhi;
|
||||||
struct QRhiNativeHandles;
|
struct QRhiNativeHandles;
|
||||||
|
|
||||||
class QGraphicsFrameCapturePrivate
|
class QGraphicsFrameCapturePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -43,6 +43,12 @@ public:
|
|||||||
QString capturePrefix() const { return m_capturePrefix; }
|
QString capturePrefix() const { return m_capturePrefix; }
|
||||||
virtual void setCapturePrefix(const QString &prefix) { m_capturePrefix = prefix; }
|
virtual void setCapturePrefix(const QString &prefix) { m_capturePrefix = prefix; }
|
||||||
|
|
||||||
|
virtual QString capturedFileName() const
|
||||||
|
{
|
||||||
|
return !m_capturedFilesNames.isEmpty() ? m_capturedFilesNames.last() : QString();
|
||||||
|
}
|
||||||
|
virtual QStringList capturedFilesNames() const { return m_capturedFilesNames; }
|
||||||
|
|
||||||
virtual bool initialized() const = 0;
|
virtual bool initialized() const = 0;
|
||||||
virtual bool isCapturing() const = 0;
|
virtual bool isCapturing() const = 0;
|
||||||
virtual void openCapture() = 0;
|
virtual void openCapture() = 0;
|
||||||
@ -53,6 +59,7 @@ protected:
|
|||||||
void *m_nativeHandle = nullptr;
|
void *m_nativeHandle = nullptr;
|
||||||
QString m_capturePath;
|
QString m_capturePath;
|
||||||
QString m_capturePrefix;
|
QString m_capturePrefix;
|
||||||
|
QStringList m_capturedFilesNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -111,6 +111,7 @@ void QGraphicsFrameCaptureMetal::endCaptureFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[m_captureManager stopCapture];
|
[m_captureManager stopCapture];
|
||||||
|
m_capturedFilesNames.append(QString::fromNSString(m_traceURL.path));
|
||||||
frameNumber++;
|
frameNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,18 @@ void QGraphicsFrameCaptureRenderDoc::endCaptureFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qCInfo(lcGraphicsFrameCapture) << "A frame capture is going to end.";
|
qCInfo(lcGraphicsFrameCapture) << "A frame capture is going to end.";
|
||||||
s_rdocApi->EndFrameCapture(m_nativeHandle, nullptr);
|
uint32_t result = s_rdocApi->EndFrameCapture(m_nativeHandle, nullptr);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
uint32_t count = s_rdocApi->GetNumCaptures();
|
||||||
|
uint32_t pathLength = 0;
|
||||||
|
s_rdocApi->GetCapture(count - 1, nullptr, &pathLength, nullptr);
|
||||||
|
if (pathLength > 0) {
|
||||||
|
QVarLengthArray<char> name(pathLength, 0);
|
||||||
|
s_rdocApi->GetCapture(count - 1, name.data(), &pathLength, nullptr);
|
||||||
|
m_capturedFilesNames.append(QString::fromUtf8(name.data(), -1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGraphicsFrameCaptureRenderDoc::updateCapturePathAndTemplate()
|
void QGraphicsFrameCaptureRenderDoc::updateCapturePathAndTemplate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user