Switch event browser to use a tree view with an item model

This commit is contained in:
baldurk
2021-07-01 15:15:00 +01:00
parent a8d891bc8f
commit 7793f20d1a
6 changed files with 765 additions and 649 deletions
@@ -230,9 +230,6 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
ui->EventBrowser_ApplyColors->setChecked(m_Ctx.Config().EventBrowser_ApplyColors);
ui->EventBrowser_ColorEventRow->setChecked(m_Ctx.Config().EventBrowser_ColorEventRow);
// 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);
@@ -1030,6 +1027,9 @@ void SettingsDialog::on_EventBrowser_ApplyColors_toggled(bool checked)
{
m_Ctx.Config().EventBrowser_ApplyColors = ui->EventBrowser_ApplyColors->isChecked();
// disable sub-checkbox
ui->EventBrowser_ColorEventRow->setEnabled(ui->EventBrowser_ApplyColors->isChecked());
m_Ctx.Config().Save();
}
+1 -1
View File
@@ -1100,7 +1100,7 @@ After interop is enabled you will need to reload any capture.</string>
</string>
</property>
<property name="text">
<string>Apply marker colors (requires file reload)</string>
<string>Apply marker colors</string>
</property>
</widget>
</item>
File diff suppressed because it is too large Load Diff
+19 -32
View File
@@ -35,12 +35,15 @@ class EventBrowser;
class QSpacerItem;
class QToolButton;
class RDTreeWidgetItem;
class QTimer;
class QTextStream;
class FlowLayout;
struct EventItemTag;
class RichTextViewDelegate;
struct EventItemModel;
struct EventFilterModel;
class EventBrowser : public QFrame, public IEventBrowser, public ICaptureViewer
{
private:
@@ -75,7 +78,6 @@ private slots:
void on_findEvent_returnPressed();
void on_findEvent_keyPress(QKeyEvent *event);
void on_findEvent_textEdited(const QString &arg1);
void on_events_currentItemChanged(RDTreeWidgetItem *current, RDTreeWidgetItem *previous);
void on_findNext_clicked();
void on_findPrev_clicked();
void on_stepNext_clicked();
@@ -87,51 +89,38 @@ private slots:
void findHighlight_timeout();
void events_keyPress(QKeyEvent *event);
void events_contextMenu(const QPoint &pos);
public slots:
void clearBookmarks();
bool hasBookmark(uint32_t EID);
void toggleBookmark(uint32_t EID);
void jumpToBookmark(int idx);
void events_currentChanged(const QModelIndex &current, const QModelIndex &previous);
private:
bool ShouldHide(const DrawcallDescription &drawcall);
QPair<uint32_t, uint32_t> AddDrawcalls(RDTreeWidgetItem *parent,
const rdcarray<DrawcallDescription> &draws);
void SetDrawcallTimes(RDTreeWidgetItem *node, const rdcarray<CounterResult> &results);
void ExpandNode(QModelIndex idx);
void ExpandNode(RDTreeWidgetItem *node);
bool FindEventNode(RDTreeWidgetItem *&found, RDTreeWidgetItem *parent, uint32_t eventId);
bool SelectEvent(uint32_t eventId);
void SelectEvent(QModelIndex found);
void ClearFindIcons(RDTreeWidgetItem *parent);
void ClearFindIcons();
int SetFindIcons(RDTreeWidgetItem *parent, QString filter);
int SetFindIcons(QString filter);
void updateFindResultsAvailable();
void clearBookmarks();
void jumpToBookmark(int idx);
void repopulateBookmarks();
void highlightBookmarks();
bool hasBookmark(RDTreeWidgetItem *node);
RDTreeWidgetItem *FindNode(RDTreeWidgetItem *parent, QString filter, uint32_t after);
int FindEvent(RDTreeWidgetItem *parent, QString filter, uint32_t after, bool forward);
int FindEvent(QModelIndex parent, QString filter, uint32_t after, bool forward);
int FindEvent(QString filter, uint32_t after, bool forward);
void Find(bool forward);
QString GetExportDrawcallString(int indent, bool firstchild, const DrawcallDescription &drawcall);
double GetDrawTime(const DrawcallDescription &drawcall);
void GetMaxNameLength(int &maxNameLength, int indent, bool firstchild,
const DrawcallDescription &drawcall);
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,
const DrawcallDescription &drawcall);
const QModelIndex &idx);
QPalette m_redPalette;
TimeUnit m_TimeUnit = TimeUnit::Count;
RichTextViewDelegate *m_delegate = NULL;
rdcarray<CounterResult> m_Times;
EventItemModel *m_Model;
EventFilterModel *m_FilterModel;
TimeUnit m_TimeUnit = TimeUnit::Count;
QTimer *m_FindHighlight;
@@ -139,9 +128,7 @@ private:
QSpacerItem *m_BookmarkSpacer;
QMap<uint32_t, QToolButton *> m_BookmarkButtons;
void RefreshIcon(RDTreeWidgetItem *item, EventItemTag tag);
void RefreshShaderMessages();
Ui::EventBrowser *ui;
ICaptureContext &m_Ctx;
};
+3 -3
View File
@@ -467,7 +467,7 @@
</widget>
</item>
<item>
<widget class="RDTreeWidget" name="events">
<widget class="RDTreeView" name="events">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
@@ -510,9 +510,9 @@
</widget>
<customwidgets>
<customwidget>
<class>RDTreeWidget</class>
<class>RDTreeView</class>
<extends>QTreeView</extends>
<header>Widgets/Extended/RDTreeWidget.h</header>
<header>Widgets/Extended/RDTreeView.h</header>
</customwidget>
<customwidget>
<class>RDLineEdit</class>
+1
View File
@@ -186,6 +186,7 @@ public:
{
return usedCount == o.usedCount && ItemHelper<T>::equalRange(elems, o.elems, usedCount);
}
bool operator!=(const rdcarray<T> &o) const { return !(*this == o); }
bool operator<(const rdcarray<T> &o) const
{
if(usedCount != o.usedCount)