mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-11 01:01:05 +00:00
Add simple stubbed UI for entering filter expressions
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
RESOURCE_DEF(del, "del.png") \
|
||||
RESOURCE_DEF(disconnect, "disconnect.png") \
|
||||
RESOURCE_DEF(find, "find.png") \
|
||||
RESOURCE_DEF(filter, "filter.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: 800 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -71,6 +71,8 @@
|
||||
<file>del@2x.png</file>
|
||||
<file>disconnect.png</file>
|
||||
<file>disconnect@2x.png</file>
|
||||
<file>filter.png</file>
|
||||
<file>filter@2x.png</file>
|
||||
<file>find.png</file>
|
||||
<file>find@2x.png</file>
|
||||
<file>flag_green.png</file>
|
||||
|
||||
@@ -863,6 +863,7 @@ private:
|
||||
struct EventFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
EventFilterModel(ICaptureContext &ctx) : m_Ctx(ctx) {}
|
||||
void ParseExpression(QString expr) { qInfo() << expr; }
|
||||
protected:
|
||||
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
|
||||
{
|
||||
@@ -979,13 +980,20 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent)
|
||||
m_FindHighlight->setSingleShot(true);
|
||||
connect(m_FindHighlight, &QTimer::timeout, this, &EventBrowser::findHighlight_timeout);
|
||||
|
||||
m_FilterTimeout = new QTimer(this);
|
||||
m_FilterTimeout->setInterval(1200);
|
||||
m_FilterTimeout->setSingleShot(true);
|
||||
connect(m_FilterTimeout, &QTimer::timeout, this, &EventBrowser::filter_apply);
|
||||
|
||||
QObject::connect(ui->closeFind, &QToolButton::clicked, this, &EventBrowser::on_HideFindJump);
|
||||
QObject::connect(ui->closeJump, &QToolButton::clicked, this, &EventBrowser::on_HideFindJump);
|
||||
QObject::connect(ui->closeFilter, &QToolButton::clicked, [this]() { ui->filterStrip->hide(); });
|
||||
QObject::connect(ui->events, &RDTreeView::keyPress, this, &EventBrowser::events_keyPress);
|
||||
QObject::connect(ui->events->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
||||
&EventBrowser::events_currentChanged);
|
||||
ui->jumpStrip->hide();
|
||||
ui->findStrip->hide();
|
||||
ui->filterStrip->hide();
|
||||
ui->bookmarkStrip->hide();
|
||||
|
||||
m_BookmarkStripLayout = new FlowLayout(ui->bookmarkStrip, 0, 3, 3);
|
||||
@@ -1051,6 +1059,7 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent)
|
||||
}
|
||||
|
||||
OnCaptureClosed();
|
||||
filter_apply();
|
||||
|
||||
m_redPalette = palette();
|
||||
m_redPalette.setColor(QPalette::Base, Qt::red);
|
||||
@@ -1102,6 +1111,7 @@ void EventBrowser::OnCaptureLoaded()
|
||||
repopulateBookmarks();
|
||||
|
||||
ui->find->setEnabled(true);
|
||||
ui->filter->setEnabled(true);
|
||||
ui->gotoEID->setEnabled(true);
|
||||
ui->timeDraws->setEnabled(true);
|
||||
ui->bookmark->setEnabled(true);
|
||||
@@ -1123,6 +1133,7 @@ void EventBrowser::OnCaptureClosed()
|
||||
setPersistData(p);
|
||||
|
||||
ui->find->setEnabled(false);
|
||||
ui->filter->setEnabled(false);
|
||||
ui->gotoEID->setEnabled(false);
|
||||
ui->timeDraws->setEnabled(false);
|
||||
ui->bookmark->setEnabled(false);
|
||||
@@ -1147,6 +1158,12 @@ void EventBrowser::on_find_clicked()
|
||||
ui->findEvent->setFocus();
|
||||
}
|
||||
|
||||
void EventBrowser::on_filter_clicked()
|
||||
{
|
||||
ui->filterStrip->show();
|
||||
ui->filterExpression->setFocus();
|
||||
}
|
||||
|
||||
void EventBrowser::on_gotoEID_clicked()
|
||||
{
|
||||
ui->jumpStrip->show();
|
||||
@@ -1190,6 +1207,9 @@ void EventBrowser::events_currentChanged(const QModelIndex ¤t, const QMode
|
||||
uint32_t selectedEID = GetSelectedEID(current);
|
||||
uint32_t effectiveEID = GetEffectiveEID(current);
|
||||
|
||||
if(selectedEID == m_Ctx.CurSelectedEvent() && effectiveEID == m_Ctx.CurEvent())
|
||||
return;
|
||||
|
||||
m_Ctx.SetEventID({this}, selectedEID, effectiveEID);
|
||||
|
||||
m_Model->RefreshCache();
|
||||
@@ -1239,6 +1259,19 @@ void EventBrowser::findHighlight_timeout()
|
||||
updateFindResultsAvailable();
|
||||
}
|
||||
|
||||
void EventBrowser::filter_apply()
|
||||
{
|
||||
// unselect everything while applying the filter, to avoid updating the source model while the
|
||||
// filter is processing if the current event is no longer selected
|
||||
uint32_t curSelEvent = m_Ctx.CurSelectedEvent();
|
||||
ui->events->clearSelection();
|
||||
ui->events->setCurrentIndex(QModelIndex());
|
||||
|
||||
m_FilterModel->ParseExpression(ui->filterExpression->text());
|
||||
|
||||
ui->events->setCurrentIndex(m_FilterModel->mapFromSource(m_Model->GetIndexForEID(curSelEvent)));
|
||||
}
|
||||
|
||||
void EventBrowser::on_findEvent_textEdited(const QString &arg1)
|
||||
{
|
||||
if(arg1.isEmpty())
|
||||
@@ -1254,6 +1287,29 @@ void EventBrowser::on_findEvent_textEdited(const QString &arg1)
|
||||
}
|
||||
}
|
||||
|
||||
void EventBrowser::on_filterExpression_returnPressed()
|
||||
{
|
||||
// stop the timer, we'll manually fire it instantly
|
||||
if(m_FilterTimeout->isActive())
|
||||
m_FilterTimeout->stop();
|
||||
|
||||
filter_apply();
|
||||
}
|
||||
|
||||
void EventBrowser::on_filterExpression_textEdited(const QString &text)
|
||||
{
|
||||
if(text.isEmpty())
|
||||
{
|
||||
m_FilterTimeout->stop();
|
||||
|
||||
filter_apply();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FilterTimeout->start(); // restart
|
||||
}
|
||||
}
|
||||
|
||||
void EventBrowser::on_findEvent_returnPressed()
|
||||
{
|
||||
// stop the timer, we'll manually fire it instantly
|
||||
@@ -1552,6 +1608,11 @@ void EventBrowser::events_keyPress(QKeyEvent *event)
|
||||
on_gotoEID_clicked();
|
||||
event->accept();
|
||||
}
|
||||
else if(event->key() == Qt::Key_L)
|
||||
{
|
||||
on_filter_clicked();
|
||||
event->accept();
|
||||
}
|
||||
else if(event->key() == Qt::Key_B)
|
||||
{
|
||||
on_bookmark_clicked();
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
private slots:
|
||||
// automatic slots
|
||||
void on_find_clicked();
|
||||
void on_filter_clicked();
|
||||
void on_gotoEID_clicked();
|
||||
void on_timeDraws_clicked();
|
||||
void on_bookmark_clicked();
|
||||
@@ -81,6 +82,8 @@ private slots:
|
||||
void on_findEvent_returnPressed();
|
||||
void on_findEvent_keyPress(QKeyEvent *event);
|
||||
void on_findEvent_textEdited(const QString &arg1);
|
||||
void on_filterExpression_returnPressed();
|
||||
void on_filterExpression_textEdited(const QString &text);
|
||||
void on_findNext_clicked();
|
||||
void on_findPrev_clicked();
|
||||
void on_stepNext_clicked();
|
||||
@@ -90,6 +93,7 @@ private slots:
|
||||
|
||||
// manual slots
|
||||
void findHighlight_timeout();
|
||||
void filter_apply();
|
||||
void events_keyPress(QKeyEvent *event);
|
||||
void events_contextMenu(const QPoint &pos);
|
||||
void events_currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
@@ -125,7 +129,7 @@ private:
|
||||
|
||||
TimeUnit m_TimeUnit = TimeUnit::Count;
|
||||
|
||||
QTimer *m_FindHighlight;
|
||||
QTimer *m_FindHighlight, *m_FilterTimeout;
|
||||
|
||||
FlowLayout *m_BookmarkStripLayout;
|
||||
QSpacerItem *m_BookmarkSpacer;
|
||||
|
||||
@@ -112,6 +112,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="filter">
|
||||
<property name="toolTip">
|
||||
<string>Show event filter</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/filter.png</normaloff>:/filter.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="gotoEID">
|
||||
<property name="toolTip">
|
||||
@@ -398,6 +412,76 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item><item>
|
||||
<widget class="QWidget" name="filterStrip" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../Resources/resources.qrc">:/filter.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="RDLineEdit" name="filterExpression">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeFilter">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/cross.png</normaloff>:/cross.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="bookmarkStrip" native="true">
|
||||
|
||||
Reference in New Issue
Block a user