When a custom name is changed, refresh the UI to propagate it properly

This commit is contained in:
baldurk
2017-11-16 14:13:33 +00:00
parent 7c8628b237
commit 2ac0802b10
14 changed files with 117 additions and 27 deletions
+15 -4
View File
@@ -590,15 +590,24 @@ void CaptureContext::SetEventID(const QVector<ILogViewer *> &exclude, uint32_t s
m_CurGLPipelineState, m_CurVulkanPipelineState);
});
bool updateSelectedEvent = force || prevSelectedEventID != selectedEventID;
bool updateEvent = force || prevEventID != eventID;
RefreshUIStatus(exclude, updateSelectedEvent, updateEvent);
}
void CaptureContext::RefreshUIStatus(const QVector<ILogViewer *> &exclude, bool updateSelectedEvent,
bool updateEvent)
{
for(ILogViewer *logviewer : m_LogViewers)
{
if(exclude.contains(logviewer))
continue;
if(force || prevSelectedEventID != selectedEventID)
logviewer->OnSelectedEventChanged(selectedEventID);
if(force || prevEventID != eventID)
logviewer->OnEventChanged(eventID);
if(updateSelectedEvent)
logviewer->OnSelectedEventChanged(m_SelectedEventID);
if(updateEvent)
logviewer->OnEventChanged(m_EventID);
}
}
@@ -662,6 +671,8 @@ void CaptureContext::SetResourceCustomName(ResourceId id, const QString &name)
{
m_CustomNames[id] = name;
}
RefreshUIStatus({}, true, true);
}
void *CaptureContext::FillWindowingData(uintptr_t widget)
+4
View File
@@ -77,7 +77,11 @@ public:
void SetEventID(const QVector<ILogViewer *> &exclude, uint32_t selectedEventID, uint32_t eventID,
bool force = false) override;
void RefreshStatus() override { SetEventID({}, m_SelectedEventID, m_EventID, true); }
void RefreshUIStatus(const QVector<ILogViewer *> &exclude, bool updateSelectedEvent,
bool updateEvent);
void AddLogViewer(ILogViewer *f) override
{
m_LogViewers.push_back(f);
+12 -6
View File
@@ -1386,6 +1386,8 @@ void BufferViewer::OnEventChanged(uint32_t eventID)
m_ModelVSOut->secondaryName(), m_ModelGSOut->posName(), m_ModelGSOut->secondaryName(),
};
updateWindowTitle();
const DrawcallDescription *draw = m_Ctx.CurDrawcall();
configureDrawRange();
@@ -2597,12 +2599,11 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId
m_ByteSize = byteSize;
m_BufferID = id;
updateWindowTitle();
BufferDescription *buf = m_Ctx.GetBuffer(id);
if(buf)
{
setWindowTitle(m_Ctx.GetResourceName(id) + lit(" - Contents"));
m_ObjectByteSize = buf->length;
}
processFormat(format);
}
@@ -2617,16 +2618,21 @@ void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, c
m_TexMip = mip;
m_BufferID = id;
updateWindowTitle();
TextureDescription *tex = m_Ctx.GetTexture(id);
if(tex)
{
setWindowTitle(m_Ctx.GetResourceName(id) + lit(" - Contents"));
m_ObjectByteSize = tex->byteSize;
}
processFormat(format);
}
void BufferViewer::updateWindowTitle()
{
if(!m_MeshView)
setWindowTitle(m_Ctx.GetResourceName(m_BufferID) + lit(" - Contents"));
}
void BufferViewer::render_mouseWheel(QWheelEvent *e)
{
if(m_CurrentCamera)
+2
View File
@@ -129,6 +129,8 @@ private:
IReplayOutput *m_Output;
void updateWindowTitle();
void configureDrawRange();
void RT_UpdateAndDisplay(IReplayController *);
+21 -7
View File
@@ -562,14 +562,9 @@ PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint p
m_Pixel = point;
m_Display = display;
m_ID = id;
TextureDescription *tex = m_Ctx.GetTexture(id);
QString title =
tr("Pixel History on %1 for (%2, %3)").arg(m_Ctx.GetResourceName(id)).arg(point.x()).arg(point.y());
if(tex->msSamp > 1)
title += tr(" @ Sample %1").arg(display.sampleIdx);
setWindowTitle(title);
updateWindowTitle();
QString channelStr;
if(display.Red)
@@ -614,6 +609,20 @@ PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint p
m_Ctx.AddLogViewer(this);
}
void PixelHistoryView::updateWindowTitle()
{
QString title = tr("Pixel History on %1 for (%2, %3)")
.arg(m_Ctx.GetResourceName(m_ID))
.arg(m_Pixel.x())
.arg(m_Pixel.y());
TextureDescription *tex = m_Ctx.GetTexture(m_ID);
if(tex->msSamp > 1)
title += tr(" @ Sample %1").arg(m_Display.sampleIdx);
setWindowTitle(title);
}
PixelHistoryView::~PixelHistoryView()
{
disableTimelineHighlight();
@@ -654,6 +663,11 @@ void PixelHistoryView::OnLogfileClosed()
ToolWindowManager::closeToolWindow(this);
}
void PixelHistoryView::OnEventChanged(uint32_t eventID)
{
updateWindowTitle();
}
void PixelHistoryView::SetHistory(const rdcarray<PixelModification> &history)
{
m_Model->setHistory(history);
+4 -1
View File
@@ -52,7 +52,7 @@ public:
void OnLogfileLoaded() override;
void OnLogfileClosed() override;
void OnSelectedEventChanged(uint32_t eventID) override {}
void OnEventChanged(uint32_t eventID) override {}
void OnEventChanged(uint32_t eventID) override;
private slots:
// automatic slots
void on_events_customContextMenuRequested(const QPoint &pos);
@@ -66,9 +66,12 @@ private:
void enableTimelineHighlight();
void disableTimelineHighlight();
void updateWindowTitle();
Ui::PixelHistoryView *ui;
ICaptureContext &m_Ctx;
ResourceId m_ID;
TextureDisplay m_Display;
QPoint m_Pixel;
PixelHistoryItemModel *m_Model;
+13
View File
@@ -280,6 +280,14 @@ void ResourceInspector::OnLogfileClosed()
m_Resource = ResourceId();
}
void ResourceInspector::OnEventChanged(uint32_t eventID)
{
Inspect(m_Resource);
m_ResourceModel->reset();
m_FilterModel->sort(0);
}
void ResourceInspector::on_renameResource_clicked()
{
if(!ui->resourceNameEdit->isVisible())
@@ -324,6 +332,11 @@ void ResourceInspector::on_resetName_clicked()
ui->resetName->hide();
m_Ctx.SetResourceCustomName(m_Resource, QString());
// force a refresh to pick up the new name
ResourceId id = m_Resource;
m_Resource = ResourceId();
Inspect(id);
}
void ResourceInspector::on_cancelResourceListFilter_clicked()
+1 -1
View File
@@ -53,7 +53,7 @@ public:
void OnLogfileLoaded() override;
void OnLogfileClosed() override;
void OnSelectedEventChanged(uint32_t eventID) override {}
void OnEventChanged(uint32_t eventID) override {}
void OnEventChanged(uint32_t eventID) override;
public slots:
// automatic slots
void on_renameResource_clicked();
+17 -7
View File
@@ -290,19 +290,14 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
m_Pipeline = pipeline;
m_Trace = trace;
m_Stage = stage;
m_DebugContext = debugContext;
// no replacing allowed, stay in find mode
m_FindReplace->allowUserModeChange(false);
if(!shader || !bind)
m_Trace = NULL;
if(trace)
setWindowTitle(QFormatStr("Debugging %1 - %2")
.arg(m_Ctx.CurPipelineState().GetShaderName(stage))
.arg(debugContext));
else
setWindowTitle(m_Ctx.CurPipelineState().GetShaderName(stage));
updateWindowTitle();
if(shader)
{
@@ -572,6 +567,19 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
}
}
void ShaderViewer::updateWindowTitle()
{
if(m_ShaderDetails)
{
if(m_Trace)
setWindowTitle(QFormatStr("Debugging %1 - %2")
.arg(m_Ctx.CurPipelineState().GetShaderName(m_Stage))
.arg(m_DebugContext));
else
setWindowTitle(m_Ctx.CurPipelineState().GetShaderName(m_Stage));
}
}
ShaderViewer::~ShaderViewer()
{
// don't want to async invoke while using 'this', so save the trace separately
@@ -597,6 +605,8 @@ void ShaderViewer::OnLogfileClosed()
void ShaderViewer::OnEventChanged(uint32_t eventID)
{
updateDebugging();
updateWindowTitle();
}
ScintillaEdit *ShaderViewer::AddFileScintilla(const QString &name, const QString &text)
+3 -1
View File
@@ -152,12 +152,13 @@ private:
void debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader,
ResourceId pipeline, ShaderStage stage, ShaderDebugTrace *trace,
const QString &debugContext);
bool eventFilter(QObject *watched, QEvent *event) override;
const rdcarray<ShaderVariable> *GetVariableList(VariableCategory varCat, int arrayIdx);
void getRegisterFromWord(const QString &text, VariableCategory &varCat, int &varIdx, int &arrayIdx);
void updateWindowTitle();
void showVariableTooltip(VariableCategory varCat, int varIdx, int arrayIdx);
void updateVariableTooltip();
void hideVariableTooltip();
@@ -172,6 +173,7 @@ private:
const ShaderBindpointMapping *m_Mapping = NULL;
const ShaderReflection *m_ShaderDetails = NULL;
ShaderStage m_Stage;
QString m_DebugContext;
ResourceId m_Pipeline;
ScintillaEdit *m_DisassemblyView = NULL;
QFrame *m_DisassemblyToolbar = NULL;
+15
View File
@@ -2561,6 +2561,16 @@ void TextureViewer::OnEventChanged(uint32_t eventID)
UI_CreateThumbnails();
UI_UpdateTextureDetails();
refreshTextureList();
// iterate over locked tabs, and update the name if it's changed
for(QWidget *w : m_LockedTabs.values())
{
ResourceId id = w->property("id").value<ResourceId>();
w->setWindowTitle(m_Ctx.GetResourceName(id));
}
QVector<BoundResource> RTs = Following::GetOutputTargets(m_Ctx);
BoundResource Depth = Following::GetDepthTarget(m_Ctx);
@@ -3450,6 +3460,11 @@ void TextureViewer::on_textureListFilter_editTextChanged(const QString &text)
}
void TextureViewer::on_textureListFilter_currentIndexChanged(int index)
{
refreshTextureList();
}
void TextureViewer::refreshTextureList()
{
TextureListItemModel *model = (TextureListItemModel *)ui->textureList->model();
+2
View File
@@ -224,6 +224,8 @@ private:
void Reset();
void refreshTextureList();
ResourcePreview *UI_CreateThumbnail(ThumbnailStrip *strip);
void UI_CreateThumbnails();
void InitResourcePreview(ResourcePreview *prev, ResourceId id, CompType typeHint, bool force,
+7
View File
@@ -73,6 +73,7 @@ TimelineBar::~TimelineBar()
void TimelineBar::HighlightResourceUsage(ResourceId id)
{
m_ID = id;
m_UsageEvents.clear();
m_UsageTarget = m_Ctx.GetResourceName(id);
@@ -91,6 +92,7 @@ void TimelineBar::HighlightResourceUsage(ResourceId id)
void TimelineBar::HighlightHistory(ResourceId id, const QList<PixelModification> &history)
{
m_ID = id;
m_HistoryTarget = QString();
m_HistoryEvents.clear();
@@ -131,6 +133,11 @@ void TimelineBar::OnLogfileLoaded()
void TimelineBar::OnEventChanged(uint32_t eventID)
{
if(!m_HistoryTarget.isEmpty())
m_HistoryTarget = m_Ctx.GetResourceName(m_ID);
if(!m_UsageTarget.isEmpty())
m_UsageTarget = m_Ctx.GetResourceName(m_ID);
viewport()->update();
}
+1
View File
@@ -75,6 +75,7 @@ private:
QVector<uint32_t> m_RootDraws;
QVector<uint32_t> m_Draws;
ResourceId m_ID;
QString m_HistoryTarget;
QList<PixelModification> m_HistoryEvents;