Update buffer formatter help text, save its visibility in config

This commit is contained in:
baldurk
2019-11-29 11:10:06 +00:00
parent e40094691c
commit f514815e3c
6 changed files with 28 additions and 2 deletions
@@ -308,6 +308,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
\
CONFIG_SETTING_VAL(public, int, int, LocalProxyAPI, -1) \
\
CONFIG_SETTING_VAL(public, bool, bool, BufferFormatter_ShowHelp, true) \
\
CONFIG_SETTING_VAL(public, int, TimeUnit, EventBrowser_TimeUnit, TimeUnit::Microseconds) \
\
CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_AddFake, true) \
@@ -551,6 +553,12 @@ For more information about some of these settings that are user-facing see
Defaults to ``-1``.
.. data:: BufferFormatter_ShowHelp
``True`` if the buffer formatter's help section should be shown.
Defaults to ``True``.
.. data:: EventBrowser_TimeUnit
The :class:`TimeUnit` to use to display the duration column in the :class:`EventBrowser`.
@@ -41,9 +41,17 @@ BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent)
BufferFormatSpecifier::~BufferFormatSpecifier()
{
if(m_Ctx)
m_Ctx->Config().BufferFormatter_ShowHelp = ui->helpText->isVisible();
delete ui;
}
void BufferFormatSpecifier::setContext(ICaptureContext *ctx)
{
m_Ctx = ctx;
showHelp(m_Ctx->Config().BufferFormatter_ShowHelp);
}
void BufferFormatSpecifier::toggleHelp()
{
ui->helpText->setVisible(!ui->helpText->isVisible());
@@ -26,6 +26,8 @@
#include <QWidget>
struct ICaptureContext;
namespace Ui
{
class BufferFormatSpecifier;
@@ -39,6 +41,8 @@ public:
explicit BufferFormatSpecifier(QWidget *parent = 0);
~BufferFormatSpecifier();
void setContext(ICaptureContext *ctx);
signals:
void processFormat(const QString &format);
@@ -53,4 +57,5 @@ private slots:
private:
Ui::BufferFormatSpecifier *ui;
ICaptureContext *m_Ctx;
};
+4 -1
View File
@@ -75,7 +75,10 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="helpText">
<property name="text">
<string>Type in a buffer format declaration, including struct definitions. Comments and {} braces are skipped, : semantics are ignored.
<string>Type in a buffer format declaration. C and C++ comments are skipped, semantics are ignored.
Structs can be defined and nested, and if no variables are 'loose' the last struct specified will be used.
Declare each element as an hlsl/glsl variable, e.g: &quot;float4 first; float2 second; uint2 third;&quot; or vec4/vec2.
Basic types accepted: bool, byte, short, int, half, float, double.
+2
View File
@@ -1730,6 +1730,8 @@ BufferViewer::BufferViewer(ICaptureContext &ctx, bool meshview, QWidget *parent)
m_MeshView = meshview;
ui->formatSpecifier->setContext(&m_Ctx);
m_Flycam = new FlycamWrapper();
m_Arcball = new ArcballWrapper();
m_CurrentCamera = m_Arcball;
@@ -43,7 +43,7 @@ ConstantBufferPreviewer::ConstantBufferPreviewer(ICaptureContext &ctx, const Sha
QObject::connect(ui->formatSpecifier, &BufferFormatSpecifier::processFormat, this,
&ConstantBufferPreviewer::processFormat);
ui->formatSpecifier->showHelp(false);
ui->formatSpecifier->setContext(&m_Ctx);
ui->splitter->setCollapsible(1, true);
ui->splitter->setSizes({1, 0});