Add settings popup that explains & documents filters

This commit is contained in:
baldurk
2021-07-01 15:15:03 +01:00
parent 6272683678
commit c5457a141b
12 changed files with 1208 additions and 498 deletions
+1
View File
@@ -523,6 +523,7 @@ void Analytics::DocumentReport()
{
QDialog dialog;
dialog.setWindowTitle(lit("Sample Analytics Report"));
dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dialog.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
dialog.setFixedSize(600, 500);
+5 -2
View File
@@ -309,6 +309,9 @@ work is done then the parameters can be used as a cache key to cache any data on
expression.
:param str name: The name of the filter function.
:param str description: The description of the filter function. This should explain the available
parameters (if applicable) and what the filter does. It will be used for documenting to users
what each filter means.
:param EventFilterCallback filter: The callback to call for each candidate event to perform
filtering.
:param FilterParseCallback parser: The callback to call when the parsing the parameters and checking
@@ -318,8 +321,8 @@ expression.
:return: Whether or not the registration was successful.
:rtype: bool
)");
virtual bool RegisterEventFilterFunction(const rdcstr &name, EventFilterCallback filter,
FilterParseCallback parser,
virtual bool RegisterEventFilterFunction(const rdcstr &name, const rdcstr &description,
EventFilterCallback filter, FilterParseCallback parser,
AutoCompleteCallback completer) = 0;
DOCUMENT(R"(Unregisters an event browser filter function that was previously registered.
+1
View File
@@ -58,6 +58,7 @@
RESOURCE_DEF(disconnect, "disconnect.png") \
RESOURCE_DEF(find, "find.png") \
RESOURCE_DEF(filter, "filter.png") \
RESOURCE_DEF(filter_reapply, "filter_reapply.png") \
RESOURCE_DEF(arrow_out, "arrow_out.png") \
RESOURCE_DEF(flag_green, "flag_green.png") \
RESOURCE_DEF(flip_y, "flip_y.png") \
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+2
View File
@@ -73,6 +73,8 @@
<file>disconnect@2x.png</file>
<file>filter.png</file>
<file>filter@2x.png</file>
<file>filter_reapply.png</file>
<file>filter_reapply@2x.png</file>
<file>find.png</file>
<file>find@2x.png</file>
<file>flag_green.png</file>
@@ -625,7 +625,9 @@ RDTreeWidget::RDTreeWidget(QWidget *parent) : RDTreeView(parent)
RDTreeWidget::~RDTreeWidget()
{
blockSignals(true);
RDTreeView::setModel(NULL);
blockSignals(false);
delete m_root;
delete m_model;
@@ -842,7 +844,10 @@ void RDTreeWidget::leaveEvent(QEvent *e)
void RDTreeWidget::focusOutEvent(QFocusEvent *event)
{
if(m_clearSelectionOnFocusLoss)
{
setCurrentItem(NULL);
clearSelection();
}
RDTreeView::focusOutEvent(event);
}
File diff suppressed because it is too large Load Diff
+67 -2
View File
@@ -41,6 +41,12 @@ class QTimer;
class QTextStream;
class FlowLayout;
struct EventItemTag;
class RDLabel;
class RDTreeWidget;
class RDTreeWidgetItem;
class RDTextEdit;
class QListWidget;
class QCheckBox;
typedef QSet<uint> RDTreeViewExpansionState;
@@ -48,6 +54,38 @@ class RichTextViewDelegate;
struct EventItemModel;
struct EventFilterModel;
struct ParseTrace;
enum class MatchType
{
MustMatch,
Normal,
CantMatch
};
struct FilterExpression
{
MatchType matchType;
bool function;
QString name;
QString params;
QString printName() const
{
if(function)
return QFormatStr("$%1(%2)").arg(name).arg(params);
return name;
}
int position = -1;
int length = 0;
QColor col;
QVector<FilterExpression> exprs;
};
class ParseErrorTipLabel : public QLabel
{
private:
@@ -80,8 +118,8 @@ public:
void UpdateDurationColumn() override;
APIEvent GetAPIEventForEID(uint32_t eid) override;
const DrawcallDescription *GetDrawcallForEID(uint32_t eid) override;
bool RegisterEventFilterFunction(const rdcstr &name, EventFilterCallback filter,
FilterParseCallback parser,
bool RegisterEventFilterFunction(const rdcstr &name, const rdcstr &description,
EventFilterCallback filter, FilterParseCallback parser,
AutoCompleteCallback completer) override;
bool UnregisterEventFilterFunction(const rdcstr &name) override;
@@ -125,6 +163,11 @@ private slots:
// manual slots
void findHighlight_timeout();
void explanation_currentItemChanged(RDTreeWidgetItem *current, RDTreeWidgetItem *prev);
void settings_filterApply();
void filterSettings_clicked();
void filter_forceCompletion_keyPress(QKeyEvent *e);
void filter_CompletionBegin(QString prefix);
void filter_apply();
void events_keyPress(QKeyEvent *event);
void events_contextMenu(const QPoint &pos);
@@ -147,6 +190,11 @@ private:
int FindEvent(QString filter, uint32_t after, bool forward);
void Find(bool forward);
void CreateFilterDialog();
void AddFilterExplanations(QString parentFunc, RDTreeWidgetItem *root,
QVector<FilterExpression> exprs, QString &notes);
QString GetExportString(int indent, bool firstchild, const QModelIndex &idx);
void GetMaxNameLength(int &maxNameLength, int indent, bool firstchild, const QModelIndex &idx);
void ExportDrawcall(QTextStream &writer, int maxNameLength, int indent, bool firstchild,
@@ -165,6 +213,7 @@ private:
QTimer *m_FindHighlight, *m_FilterTimeout;
ParseTrace *m_ParseTrace;
ParseErrorTipLabel *m_ParseError;
QPoint m_ParseErrorPos;
@@ -172,6 +221,22 @@ private:
QSpacerItem *m_BookmarkSpacer;
QMap<uint32_t, QToolButton *> m_BookmarkButtons;
struct
{
QDialog *Dialog;
RDLabel *Notes;
QListWidget *FuncList;
RDTextEdit *FuncDocs;
RDTextEdit *Filter;
RDTreeWidget *Explanation;
QCheckBox *ShowParams;
QCheckBox *ShowAll;
QCheckBox *UseCustom;
QTimer *Timeout;
} m_FilterSettings;
void RefreshShaderMessages();
Ui::EventBrowser *ui;
ICaptureContext &m_Ctx;
+37
View File
@@ -370,6 +370,43 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="recentFilters">
<property name="toolTip">
<string>Saved filters</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../Resources/resources.qrc">
<normaloff>:/filter_reapply.png</normaloff>:/filter_reapply.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="filterSettings">
<property name="toolTip">
<string>Configuration and help for filter expressions</string>
</property>
<property name="text">
<string>Settings</string>
</property>
<property name="icon">
<iconset resource="../Resources/resources.qrc">
<normaloff>:/cog.png</normaloff>:/cog.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+2
View File
@@ -1955,6 +1955,8 @@ IF %ERRORLEVEL% NEQ 0 (echo ====================================================
<Image Include="Resources\del.png" />
<Image Include="Resources\disconnect%402x.png" />
<Image Include="Resources\disconnect.png" />
<Image Include="Resources\filter_reapply%402x.png" />
<Image Include="Resources\filter_reapply.png" />
<Image Include="Resources\find%402x.png" />
<Image Include="Resources\find.png" />
<Image Include="Resources\flag_green%402x.png" />
@@ -1897,6 +1897,12 @@
<Image Include="Resources\pixel_history%402x.png">
<Filter>Resources\Files</Filter>
</Image>
<Image Include="Resources\filter_reapply.png">
<Filter>Resources\Files</Filter>
</Image>
<Image Include="Resources\filter_reapply%402x.png">
<Filter>Resources\Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Natvis Include="python36.natvis" />