From 4a4089f31603b14ec29d9165c2cfddf68cd33192 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 16 Nov 2017 13:23:43 +0000 Subject: [PATCH] Add generic user-provided notes to save along with the capture. * In future one of the notes items would be for gathered hardware info. Not automatically, but with one button press the full configuration can be embedded. --- qrenderdoc/Code/CaptureContext.cpp | 83 ++++++++++++++++ qrenderdoc/Code/CaptureContext.h | 12 +++ qrenderdoc/Code/Interface/PersistantConfig.h | 9 ++ qrenderdoc/Code/Interface/QRDInterface.h | 54 ++++++++++ qrenderdoc/Windows/CommentView.cpp | 98 +++++++++++++++++++ qrenderdoc/Windows/CommentView.h | 62 ++++++++++++ qrenderdoc/Windows/CommentView.ui | 33 +++++++ qrenderdoc/Windows/DebugMessageView.ui | 3 + qrenderdoc/Windows/Dialogs/SettingsDialog.cpp | 9 ++ qrenderdoc/Windows/Dialogs/SettingsDialog.h | 3 + qrenderdoc/Windows/Dialogs/SettingsDialog.ui | 71 ++++++++++++++ qrenderdoc/Windows/MainWindow.cpp | 10 ++ qrenderdoc/Windows/MainWindow.h | 2 + qrenderdoc/Windows/MainWindow.ui | 6 ++ qrenderdoc/Windows/PythonShell.cpp | 14 +++ qrenderdoc/qrenderdoc.pro | 3 + qrenderdoc/qrenderdoc_local.vcxproj | 15 +++ qrenderdoc/qrenderdoc_local.vcxproj.filters | 15 +++ 18 files changed, 502 insertions(+) create mode 100644 qrenderdoc/Windows/CommentView.cpp create mode 100644 qrenderdoc/Windows/CommentView.h create mode 100644 qrenderdoc/Windows/CommentView.ui diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 842cdf3b6..5867aff08 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -34,6 +34,7 @@ #include #include "Windows/APIInspector.h" #include "Windows/BufferViewer.h" +#include "Windows/CommentView.h" #include "Windows/ConstantBufferPreviewer.h" #include "Windows/DebugMessageView.h" #include "Windows/Dialogs/CaptureDialog.h" @@ -131,6 +132,8 @@ void CaptureContext::LoadCapture(const QString &captureFile, const QString &orig { m_LoadInProgress = true; + bool newCapture = (!temporary && !Config().RecentCaptureFiles.contains(origFilename)); + LambdaThread *thread = new LambdaThread([this, captureFile, origFilename, temporary, local]() { LoadCaptureThreaded(captureFile, origFilename, temporary, local); }); @@ -165,6 +168,13 @@ void CaptureContext::LoadCapture(const QString &captureFile, const QString &orig viewer->OnCaptureLoaded(); } }); + + if(newCapture && m_Notes.contains(lit("comments"))) + { + if(!HasCommentView()) + ShowCommentView(); + RaiseDockWindow(GetCommentView()->Widget()); + } } } @@ -330,6 +340,13 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QStri bytebuf buf = access->GetSectionContents(idx); LoadBookmarks(QString::fromUtf8((const char *)buf.data(), buf.count())); } + + idx = access->FindSectionByType(SectionType::Notes); + if(idx >= 0) + { + bytebuf buf = access->GetSectionContents(idx); + LoadNotes(QString::fromUtf8((const char *)buf.data(), buf.count())); + } } m_LoadInProgress = false; @@ -633,6 +650,14 @@ bool CaptureContext::SaveCaptureTo(const QString &captureFile) Replay().GetCaptureAccess()->WriteSection(props, SaveBookmarks().toUtf8()); } + if(m_CaptureMods & CaptureModifications::Notes) + { + SectionProperties props; + props.type = SectionType::Notes; + props.version = 1; + + Replay().GetCaptureAccess()->WriteSection(props, SaveNotes().toUtf8()); + } m_CaptureMods = CaptureModifications::NoModifications; @@ -661,6 +686,7 @@ void CaptureContext::CloseCapture() m_CustomNames.clear(); m_Bookmarks.clear(); + m_Notes.clear(); m_Drawcalls.clear(); m_FirstDrawcall = m_LastDrawcall = NULL; @@ -738,6 +764,20 @@ void CaptureContext::AddMessages(const rdcarray &msgs) } } +void CaptureContext::SetNotes(const QString &key, const QString &contents) +{ + // ignore no-op changes + if(m_Notes.contains(key) && m_Notes[key] == contents) + return; + + m_Notes[key] = contents; + + m_CaptureMods |= CaptureModifications::Notes; + m_MainWindow->captureModified(); + + RefreshUIStatus({}, true, true); +} + void CaptureContext::SetBookmark(const EventBookmark &mark) { int index = m_Bookmarks.indexOf(mark); @@ -852,6 +892,26 @@ void CaptureContext::LoadBookmarks(const QString &data) } } +QString CaptureContext::SaveNotes() +{ + QVariantMap root; + for(const QString &key : m_Notes.keys()) + root[key] = m_Notes[key]; + + return VariantToJSON(root); +} + +void CaptureContext::LoadNotes(const QString &data) +{ + QVariantMap root = JSONToVariant(data); + + for(QString key : root.keys()) + { + if(!key.isEmpty()) + m_Notes[key] = root[key].toString(); + } +} + QString CaptureContext::GetResourceName(ResourceId id) { if(id == ResourceId()) @@ -1049,6 +1109,18 @@ IDebugMessageView *CaptureContext::GetDebugMessageView() return m_DebugMessageView; } +ICommentView *CaptureContext::GetCommentView() +{ + if(m_CommentView) + return m_CommentView; + + m_CommentView = new CommentView(*this, m_MainWindow); + m_CommentView->setObjectName(lit("commentView")); + setupDockWindow(m_CommentView); + + return m_CommentView; +} + IPerformanceCounterViewer *CaptureContext::GetPerformanceCounterViewer() { if(m_PerformanceCounterViewer) @@ -1144,6 +1216,11 @@ void CaptureContext::ShowDebugMessageView() m_MainWindow->showDebugMessageView(); } +void CaptureContext::ShowCommentView() +{ + m_MainWindow->showCommentView(); +} + void CaptureContext::ShowPerformanceCounterViewer() { m_MainWindow->showPerformanceCounterViewer(); @@ -1260,6 +1337,10 @@ QWidget *CaptureContext::CreateBuiltinWindow(const QString &objectName) { return GetDebugMessageView()->Widget(); } + else if(objectName == lit("commentView")) + { + return GetCommentView()->Widget(); + } else if(objectName == lit("statisticsViewer")) { return GetStatisticsViewer()->Widget(); @@ -1300,6 +1381,8 @@ void CaptureContext::BuiltinWindowClosed(QWidget *window) m_MeshPreview = NULL; else if(m_DebugMessageView && m_DebugMessageView->Widget() == window) m_DebugMessageView = NULL; + else if(m_CommentView && m_CommentView->Widget() == window) + m_CommentView = NULL; else if(m_StatisticsViewer && m_StatisticsViewer->Widget() == window) m_StatisticsViewer = NULL; else if(m_TimelineBar && m_TimelineBar->Widget() == window) diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index eb2e2c7ab..be09940e0 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -45,6 +45,7 @@ class BufferViewer; class TextureViewer; class CaptureDialog; class DebugMessageView; +class CommentView; class PerformanceCounterViewer; class StatisticsViewer; class TimelineBar; @@ -140,6 +141,8 @@ public: void MarkMessagesRead() override { m_UnreadMessageCount = 0; } void AddMessages(const rdcarray &msgs) override; + QString GetNotes(const QString &key) override { return m_Notes[key]; } + void SetNotes(const QString &key, const QString &contents) override; QList GetBookmarks() override { return m_Bookmarks; } void SetBookmark(const EventBookmark &mark) override; void RemoveBookmark(uint32_t EID) override; @@ -152,6 +155,7 @@ public: IPipelineStateViewer *GetPipelineViewer() override; ICaptureDialog *GetCaptureDialog() override; IDebugMessageView *GetDebugMessageView() override; + ICommentView *GetCommentView() override; IPerformanceCounterViewer *GetPerformanceCounterViewer() override; IStatisticsViewer *GetStatisticsViewer() override; ITimelineBar *GetTimelineBar() override; @@ -165,6 +169,7 @@ public: bool HasMeshPreview() override { return m_MeshPreview != NULL; } bool HasCaptureDialog() override { return m_CaptureDialog != NULL; } bool HasDebugMessageView() override { return m_DebugMessageView != NULL; } + bool HasCommentView() override { return m_CommentView != NULL; } bool HasPerformanceCounterViewer() override { return m_PerformanceCounterViewer != NULL; } bool HasStatisticsViewer() override { return m_StatisticsViewer != NULL; } bool HasTimelineBar() override { return m_TimelineBar != NULL; } @@ -177,6 +182,7 @@ public: void ShowPipelineViewer() override; void ShowCaptureDialog() override; void ShowDebugMessageView() override; + void ShowCommentView() override; void ShowPerformanceCounterViewer() override; void ShowStatisticsViewer() override; void ShowTimelineBar() override; @@ -253,6 +259,9 @@ private: QString SaveBookmarks(); void LoadBookmarks(const QString &data); + QString SaveNotes(); + void LoadNotes(const QString &data); + float m_LoadProgress = 0.0f; float m_PostloadProgress = 0.0f; float UpdateLoadProgress(); @@ -299,6 +308,8 @@ private: QList m_Bookmarks; + QStringMap m_Notes; + QMap m_CustomNames; int m_CustomNameCachedID = 1; @@ -325,6 +336,7 @@ private: PipelineStateViewer *m_PipelineViewer = NULL; CaptureDialog *m_CaptureDialog = NULL; DebugMessageView *m_DebugMessageView = NULL; + CommentView *m_CommentView = NULL; PerformanceCounterViewer *m_PerformanceCounterViewer = NULL; StatisticsViewer *m_StatisticsViewer = NULL; TimelineBar *m_TimelineBar = NULL; diff --git a/qrenderdoc/Code/Interface/PersistantConfig.h b/qrenderdoc/Code/Interface/PersistantConfig.h index f20dbbef5..b390df132 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.h +++ b/qrenderdoc/Code/Interface/PersistantConfig.h @@ -97,6 +97,8 @@ DECLARE_REFLECTION_STRUCT(SPIRVDisassembler); \ CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_ColorEventRow, true) \ \ + CONFIG_SETTING_VAL(public, bool, bool, Comments_ShowOnLoad, false) \ + \ CONFIG_SETTING_VAL(public, int, int, Formatter_MinFigures, 2) \ \ CONFIG_SETTING_VAL(public, int, int, Formatter_MaxFigures, 5) \ @@ -313,6 +315,13 @@ For more information about some of these settings that are user-facing see Defaults to ``True``. )", R"( +.. data:: Comments_ShowOnLoad + + ``True`` if when loading a new capture that contains a comments section, the comment viewer will + be opened and focussed. + + Defaults to ``False``. + .. data:: Formatter_MinFigures The minimum number of significant figures to show in formatted floating point values. diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index a40a259c9..34ba285da 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -393,6 +393,22 @@ protected: DECLARE_REFLECTION_STRUCT(IDebugMessageView); +DOCUMENT("The capture comments window."); +struct ICommentView +{ + DOCUMENT( + "Retrieves the QWidget for this :class:`CommentView` if PySide2 is available, or " + "otherwise unique opaque pointer that can be passed to RenderDoc functions expecting a " + "QWidget."); + virtual QWidget *Widget() = 0; + +protected: + ICommentView() = default; + ~ICommentView() = default; +}; + +DECLARE_REFLECTION_STRUCT(ICommentView); + DOCUMENT("The statistics window."); struct IStatisticsViewer { @@ -1296,6 +1312,28 @@ as well as messages generated during replay and analysis. )"); virtual void AddMessages(const rdcarray &msgs) = 0; + DOCUMENT(R"(Retrieve the contents for a given notes field. + +Examples of fields are: + +* 'comments' for generic comments to be displayed in a text field +* 'hwinfo' for a plaintext summary of the hardware and driver configuration of the system. + +:param str key: The name of the notes field to retrieve. +:return: The contents, or an empty string if the field doesn't exist. +:rtype: str +)"); + virtual QString GetNotes(const QString &key) = 0; + + DOCUMENT(R"(Set the contents for a given notes field. + +See :meth:`GetNotes` for a list of possible common field keys. + +:param str key: The name of the notes field to set. +:param str contents: The new contents to assign to that field. +)"); + virtual void SetNotes(const QString &key, const QString &contents) = 0; + DOCUMENT(R"(Get the current list of bookmarks in the capture. Each bookmark is associated with an EID and has some text attached. There will only be at most one bookmark for any given EID. @@ -1380,6 +1418,13 @@ If no bookmark exists, this function will do nothing. )"); virtual IDebugMessageView *GetDebugMessageView() = 0; + DOCUMENT(R"(Retrieve the current singleton :class:`CommentView`. + +:return: The current window, which is created (but not shown) it there wasn't one open. +:rtype: CommentView +)"); + virtual ICommentView *GetCommentView() = 0; + DOCUMENT(R"(Retrieve the current singleton :class:`PerformanceCounterViewer`. :return: The current window, which is created (but not shown) it there wasn't one open. @@ -1464,6 +1509,13 @@ If no bookmark exists, this function will do nothing. )"); virtual bool HasDebugMessageView() = 0; + DOCUMENT(R"(Check if there is a current :class:`CommentView` open. + +:return: ``True`` if there is a window open. +:rtype: ``bool`` +)"); + virtual bool HasCommentView() = 0; + DOCUMENT(R"(Check if there is a current :class:`PerformanceCounterViewer` open. :return: ``True`` if there is a window open. @@ -1514,6 +1566,8 @@ If no bookmark exists, this function will do nothing. DOCUMENT( "Raise the current :class:`DebugMessageView`, showing it in the default place if needed."); virtual void ShowDebugMessageView() = 0; + DOCUMENT("Raise the current :class:`CommentView`, showing it in the default place if needed."); + virtual void ShowCommentView() = 0; DOCUMENT( "Raise the current :class:`PerformanceCounterViewer`, showing it in the default place if " "needed."); diff --git a/qrenderdoc/Windows/CommentView.cpp b/qrenderdoc/Windows/CommentView.cpp new file mode 100644 index 000000000..7b3c64df8 --- /dev/null +++ b/qrenderdoc/Windows/CommentView.cpp @@ -0,0 +1,98 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2017 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "CommentView.h" +#include +#include "3rdparty/scintilla/include/SciLexer.h" +#include "3rdparty/scintilla/include/qt/ScintillaEdit.h" +#include "ui_CommentView.h" + +CommentView::CommentView(ICaptureContext &ctx, QWidget *parent) + : QFrame(parent), ui(new Ui::CommentView), m_Ctx(ctx) +{ + ui->setupUi(this); + + m_commentsEditor = new ScintillaEdit(this); + + m_commentsEditor->styleSetFont( + STYLE_DEFAULT, QFontDatabase::systemFont(QFontDatabase::FixedFont).family().toUtf8().data()); + m_commentsEditor->setTabWidth(4); + + QObject::connect(m_commentsEditor, &ScintillaEdit::modified, [this](int type, int, int, int, + const QByteArray &, int, int, + int) { + + if(m_ignoreModifications) + return; + + if(type & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) + { + QString text = QString::fromUtf8(m_commentsEditor->getText(m_commentsEditor->textLength() + 1)); + m_Ctx.SetNotes(lit("comments"), text); + } + }); + + ui->mainLayout->addWidget(m_commentsEditor); + + m_ignoreModifications = true; + + m_Ctx.AddCaptureViewer(this); +} + +CommentView::~CommentView() +{ + m_Ctx.BuiltinWindowClosed(this); + + m_Ctx.RemoveCaptureViewer(this); + delete ui; +} + +void CommentView::OnCaptureClosed() +{ + m_ignoreModifications = true; + m_commentsEditor->setText(""); + m_commentsEditor->emptyUndoBuffer(); +} + +void CommentView::OnCaptureLoaded() +{ + m_commentsEditor->setText(m_Ctx.GetNotes(lit("comments")).toUtf8().data()); + m_commentsEditor->emptyUndoBuffer(); + m_ignoreModifications = false; +} + +void CommentView::OnEventChanged(uint32_t eventID) +{ + QString oldText = QString::fromUtf8(m_commentsEditor->getText(m_commentsEditor->textLength() + 1)); + QString newText = m_Ctx.GetNotes(lit("comments")); + + if(oldText != newText) + { + bool oldIgnore = m_ignoreModifications; + m_ignoreModifications = true; + m_commentsEditor->setText(newText.toUtf8().data()); + m_commentsEditor->emptyUndoBuffer(); + m_ignoreModifications = oldIgnore; + } +} diff --git a/qrenderdoc/Windows/CommentView.h b/qrenderdoc/Windows/CommentView.h new file mode 100644 index 000000000..b806bdcda --- /dev/null +++ b/qrenderdoc/Windows/CommentView.h @@ -0,0 +1,62 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2017 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#pragma once + +#include +#include "Code/CaptureContext.h" + +namespace Ui +{ +class CommentView; +} + +class ScintillaEdit; + +class CommentView : public QFrame, public ICommentView, public ICaptureViewer +{ + Q_OBJECT + +public: + explicit CommentView(ICaptureContext &ctx, QWidget *parent = 0); + ~CommentView(); + + // ICommentView + QWidget *Widget() override { return this; } + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; + void OnSelectedEventChanged(uint32_t eventID) override {} + void OnEventChanged(uint32_t eventID) override; + +private slots: + +private: + Ui::CommentView *ui; + ICaptureContext &m_Ctx; + + bool m_ignoreModifications; + + ScintillaEdit *m_commentsEditor; +}; diff --git a/qrenderdoc/Windows/CommentView.ui b/qrenderdoc/Windows/CommentView.ui new file mode 100644 index 000000000..e93048801 --- /dev/null +++ b/qrenderdoc/Windows/CommentView.ui @@ -0,0 +1,33 @@ + + + CommentView + + + + 0 + 0 + 400 + 300 + + + + Capture Comments + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + diff --git a/qrenderdoc/Windows/DebugMessageView.ui b/qrenderdoc/Windows/DebugMessageView.ui index 53c2cc4a7..be08db3e9 100644 --- a/qrenderdoc/Windows/DebugMessageView.ui +++ b/qrenderdoc/Windows/DebugMessageView.ui @@ -10,6 +10,9 @@ 300 + + Debug warnings and errors + 3 diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp index 5b0bf560f..96a55b312 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp @@ -106,6 +106,8 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent) // disable sub-checkbox ui->EventBrowser_ColorEventRow->setEnabled(ui->EventBrowser_ApplyColors->isChecked()); + ui->Comments_ShowOnLoad->setChecked(m_Ctx.Config().Comments_ShowOnLoad); + ui->Formatter_MinFigures->setValue(m_Ctx.Config().Formatter_MinFigures); ui->Formatter_MaxFigures->setValue(m_Ctx.Config().Formatter_MaxFigures); ui->Formatter_NegExp->setValue(m_Ctx.Config().Formatter_NegExp); @@ -359,6 +361,13 @@ void SettingsDialog::on_EventBrowser_ColorEventRow_toggled(bool checked) m_Ctx.Config().Save(); } +void SettingsDialog::on_Comments_ShowOnLoad_toggled(bool checked) +{ + m_Ctx.Config().Comments_ShowOnLoad = ui->Comments_ShowOnLoad->isChecked(); + + m_Ctx.Config().Save(); +} + // android void SettingsDialog::on_browseTempCaptureDirectory_clicked() { diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.h b/qrenderdoc/Windows/Dialogs/SettingsDialog.h index fbe9d4657..220eff2df 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.h +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.h @@ -82,6 +82,9 @@ private slots: void on_EventBrowser_ApplyColors_toggled(bool checked); void on_EventBrowser_ColorEventRow_toggled(bool checked); + // comments + void on_Comments_ShowOnLoad_toggled(bool checked); + // android void on_browseTempCaptureDirectory_clicked(); void on_browseAdbPath_clicked(); diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui index fad7147a9..4619eabe3 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui @@ -868,6 +868,77 @@ If {spv_disas} is not used, the tool is expected to output the disassembly on st + + + Comments + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Capture Comments + + + + + + + 0 + 0 + + + + When loading a capture with comments in it, show the comments viewer and focus it when the capture is loaded. + +Only happens if the capture is not in the recent files list. + + + Show capture comments on load + + + true + + + + + + + When loading a capture with comments in it, show the comments viewer and focus it when the capture is loaded. + +Only happens if the capture is not in the recent files list. + + + + + + + Qt::Vertical + + + + 20 + 297 + + + + + + + + + Android diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index e89f98160..c4423477b 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -1552,6 +1552,16 @@ void MainWindow::on_action_Errors_and_Warnings_triggered() ui->toolWindowManager->addToolWindow(debugMessages, mainToolArea()); } +void MainWindow::on_action_Comments_triggered() +{ + QWidget *comments = m_Ctx.GetCommentView()->Widget(); + + if(ui->toolWindowManager->toolWindows().contains(comments)) + ToolWindowManager::raiseToolWindow(comments); + else + ui->toolWindowManager->addToolWindow(comments, mainToolArea()); +} + void MainWindow::on_action_Statistics_Viewer_triggered() { QWidget *stats = m_Ctx.GetStatisticsViewer()->Widget(); diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index c314f977d..c1682d505 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -90,6 +90,7 @@ public: void showPipelineViewer() { on_action_Pipeline_State_triggered(); } void showCaptureDialog() { on_action_Launch_Application_triggered(); } void showDebugMessageView() { on_action_Errors_and_Warnings_triggered(); } + void showCommentView() { on_action_Comments_triggered(); } void showStatisticsViewer() { on_action_Statistics_Viewer_triggered(); } void showTimelineBar() { on_action_Timeline_triggered(); } void showPythonShell() { on_action_Python_Shell_triggered(); } @@ -112,6 +113,7 @@ private slots: void on_action_Pipeline_State_triggered(); void on_action_Launch_Application_triggered(); void on_action_Errors_and_Warnings_triggered(); + void on_action_Comments_triggered(); void on_action_Statistics_Viewer_triggered(); void on_action_Timeline_triggered(); void on_action_Python_Shell_triggered(); diff --git a/qrenderdoc/Windows/MainWindow.ui b/qrenderdoc/Windows/MainWindow.ui index 25c8ce7c1..2c9f71196 100644 --- a/qrenderdoc/Windows/MainWindow.ui +++ b/qrenderdoc/Windows/MainWindow.ui @@ -133,6 +133,7 @@ + @@ -418,6 +419,11 @@ Sa&ve Capture As + + + Capture C&omments + + diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index 7d47fa1a1..17d16d8a1 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -111,6 +111,7 @@ struct CaptureContextInvoker : ICaptureContext virtual const QVector &DebugMessages() override { return m_Ctx.DebugMessages(); } virtual int UnreadMessageCount() override { return m_Ctx.UnreadMessageCount(); } virtual void MarkMessagesRead() override { return m_Ctx.MarkMessagesRead(); } + virtual QString GetNotes(const QString &key) override { return m_Ctx.GetNotes(key); } virtual QList GetBookmarks() override { return m_Ctx.GetBookmarks(); } virtual const D3D11Pipe::State &CurD3D11PipelineState() override { @@ -191,6 +192,10 @@ struct CaptureContextInvoker : ICaptureContext { InvokeVoidFunction(&ICaptureContext::SetResourceCustomName, id, name); } + virtual void SetNotes(const QString &key, const QString &contents) override + { + InvokeVoidFunction(&ICaptureContext::SetNotes, key, contents); + } virtual void SetBookmark(const EventBookmark &mark) override { @@ -232,6 +237,10 @@ struct CaptureContextInvoker : ICaptureContext { return InvokeRetFunction(&ICaptureContext::GetDebugMessageView); } + virtual ICommentView *GetCommentView() override + { + return InvokeRetFunction(&ICaptureContext::GetCommentView); + } virtual IPerformanceCounterViewer *GetPerformanceCounterViewer() override { return InvokeRetFunction( @@ -281,6 +290,10 @@ struct CaptureContextInvoker : ICaptureContext { return InvokeRetFunction(&ICaptureContext::HasDebugMessageView); } + virtual bool HasCommentView() override + { + return InvokeRetFunction(&ICaptureContext::HasCommentView); + } virtual bool HasPerformanceCounterViewer() override { return InvokeRetFunction(&ICaptureContext::HasPerformanceCounterViewer); @@ -327,6 +340,7 @@ struct CaptureContextInvoker : ICaptureContext { InvokeVoidFunction(&ICaptureContext::ShowDebugMessageView); } + virtual void ShowCommentView() override { InvokeVoidFunction(&ICaptureContext::ShowCommentView); } virtual void ShowPerformanceCounterViewer() override { InvokeVoidFunction(&ICaptureContext::ShowPerformanceCounterViewer); diff --git a/qrenderdoc/qrenderdoc.pro b/qrenderdoc/qrenderdoc.pro index e51a8dc6d..407798ec6 100644 --- a/qrenderdoc/qrenderdoc.pro +++ b/qrenderdoc/qrenderdoc.pro @@ -202,6 +202,7 @@ SOURCES += Code/qrenderdoc.cpp \ Windows/BufferViewer.cpp \ Widgets/Extended/RDTableView.cpp \ Windows/DebugMessageView.cpp \ + Windows/CommentView.cpp \ Windows/StatisticsViewer.cpp \ Windows/TimelineBar.cpp \ Windows/Dialogs/SettingsDialog.cpp \ @@ -269,6 +270,7 @@ HEADERS += Code/CaptureContext.h \ Windows/BufferViewer.h \ Widgets/Extended/RDTableView.h \ Windows/DebugMessageView.h \ + Windows/CommentView.h \ Windows/StatisticsViewer.h \ Windows/TimelineBar.h \ Windows/Dialogs/SettingsDialog.h \ @@ -307,6 +309,7 @@ FORMS += Windows/Dialogs/AboutDialog.ui \ Windows/BufferViewer.ui \ Windows/ShaderViewer.ui \ Windows/DebugMessageView.ui \ + Windows/CommentView.ui \ Windows/StatisticsViewer.ui \ Windows/Dialogs/SettingsDialog.ui \ Windows/Dialogs/OrderedListEditor.ui \ diff --git a/qrenderdoc/qrenderdoc_local.vcxproj b/qrenderdoc/qrenderdoc_local.vcxproj index d1bc65e80..5b844070a 100644 --- a/qrenderdoc/qrenderdoc_local.vcxproj +++ b/qrenderdoc/qrenderdoc_local.vcxproj @@ -587,6 +587,7 @@ + @@ -682,6 +683,7 @@ + @@ -887,6 +889,7 @@ + @@ -1096,6 +1099,12 @@ MOC %(Filename).h $(IntDir)generated\moc_%(Filename).cpp + + %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) + "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" + MOC %(Filename).h + $(IntDir)generated\moc_%(Filename).cpp + %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" @@ -1318,6 +1327,12 @@ UIC %(Filename).ui $(IntDir)generated\ui_%(Filename).h + + %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) + "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" + UIC %(Filename).ui + $(IntDir)generated\ui_%(Filename).h + %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" diff --git a/qrenderdoc/qrenderdoc_local.vcxproj.filters b/qrenderdoc/qrenderdoc_local.vcxproj.filters index 506eea91b..2c4fe722e 100644 --- a/qrenderdoc/qrenderdoc_local.vcxproj.filters +++ b/qrenderdoc/qrenderdoc_local.vcxproj.filters @@ -375,6 +375,9 @@ Windows + + Windows + Windows @@ -423,6 +426,9 @@ Generated Files + + Generated Files + Generated Files @@ -893,6 +899,9 @@ Generated Files + + Generated Files + Generated Files @@ -1226,6 +1235,9 @@ Windows + + Windows + Windows @@ -1313,6 +1325,9 @@ Windows + + Windows + Windows