diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index 1f3d7137e..df3a9705c 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -184,14 +184,29 @@ struct EventItemModel : public QAbstractItemModel m_FindString = text; m_FindResults.clear(); + bool eidSearch = false; + // if the user puts in @123 + if(!text.isEmpty() && text[0] == QLatin1Char('@')) + { + eidSearch = true; + text = text.mid(1); + } + bool eidOK = false; uint32_t eid = text.toUInt(&eidOK); // include EID in results first if the text parses as an integer if(eidOK && eid > 0 && eid < m_Draws.size()) - m_FindResults.push_back(GetIndexForEID(eid)); + { + // if the text doesn't exactly match the EID after converting back, don't treat this as an + // EID-only search + if(text.trimmed() != QString::number(eid)) + eidSearch = false; - if(!m_FindString.isEmpty()) + m_FindResults.push_back(GetIndexForEID(eid)); + } + + if(!m_FindString.isEmpty() && !eidSearch) { // do a depth-first search to find results AccumulateFindResults(createIndex(0, 0, TagRoot)); @@ -1777,7 +1792,6 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent) m_delegate = new RichTextViewDelegate(ui->events); ui->events->setItemDelegate(m_delegate); - ui->jumpToEID->setFont(Formatter::PreferredFont()); ui->find->setFont(Formatter::PreferredFont()); ui->events->setFont(Formatter::PreferredFont()); @@ -1825,15 +1839,14 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent) 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->closeFind, &QToolButton::clicked, this, &EventBrowser::on_HideFind); + QObject::connect(ui->closeFilter, &QToolButton::clicked, + [this]() { ui->filter->setChecked(false); }); 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(); + on_find_toggled(false); + on_filter_toggled(false); ui->bookmarkStrip->hide(); m_BookmarkStripLayout = new FlowLayout(ui->bookmarkStrip, 0, 3, 3); @@ -1874,9 +1887,7 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent) }); ctx.GetMainWindow()->RegisterShortcut(QKeySequence(Qt::Key_Escape).toString(), ui->findStrip, - [this](QWidget *) { on_HideFindJump(); }); - ctx.GetMainWindow()->RegisterShortcut(QKeySequence(Qt::Key_Escape).toString(), ui->jumpStrip, - [this](QWidget *) { on_HideFindJump(); }); + [this](QWidget *) { on_HideFind(); }); ui->events->setContextMenuPolicy(Qt::CustomContextMenu); QObject::connect(ui->events, &RDTreeView::customContextMenuRequested, this, @@ -1934,7 +1945,6 @@ EventBrowser::~EventBrowser() QKeySequence(Qt::Key_Right | Qt::ControlModifier).toString(), NULL); m_Ctx.GetMainWindow()->UnregisterShortcut(QString(), ui->findStrip); - m_Ctx.GetMainWindow()->UnregisterShortcut(QString(), ui->jumpStrip); m_Ctx.BuiltinWindowClosed(this); m_Ctx.RemoveCaptureViewer(this); @@ -1960,7 +1970,6 @@ void EventBrowser::OnCaptureLoaded() ui->find->setEnabled(true); ui->filter->setEnabled(true); - ui->gotoEID->setEnabled(true); ui->timeDraws->setEnabled(true); ui->bookmark->setEnabled(true); ui->exportDraws->setEnabled(true); @@ -1972,7 +1981,7 @@ void EventBrowser::OnCaptureClosed() { clearBookmarks(); - on_HideFindJump(); + on_HideFind(); m_FilterModel->ResetCache(); // older Qt versions lose all the sections when a model resets even if the sections don't change. @@ -1983,7 +1992,6 @@ void EventBrowser::OnCaptureClosed() ui->find->setEnabled(false); ui->filter->setEnabled(false); - ui->gotoEID->setEnabled(false); ui->timeDraws->setEnabled(false); ui->bookmark->setEnabled(false); ui->exportDraws->setEnabled(false); @@ -2000,24 +2008,18 @@ void EventBrowser::OnEventChanged(uint32_t eventId) m_Model->RefreshCache(); } -void EventBrowser::on_find_clicked() +void EventBrowser::on_find_toggled(bool checked) { - ui->jumpStrip->hide(); - ui->findStrip->show(); - ui->findEvent->setFocus(); + ui->findStrip->setVisible(checked); + if(checked) + ui->findEvent->setFocus(); } -void EventBrowser::on_filter_clicked() +void EventBrowser::on_filter_toggled(bool checked) { - ui->filterStrip->show(); - ui->filterExpression->setFocus(); -} - -void EventBrowser::on_gotoEID_clicked() -{ - ui->jumpStrip->show(); - ui->findStrip->hide(); - ui->jumpToEID->setFocus(); + ui->filterStrip->setVisible(checked); + if(checked) + ui->filterExpression->setFocus(); } void EventBrowser::on_bookmark_clicked() @@ -2079,28 +2081,17 @@ void EventBrowser::events_currentChanged(const QModelIndex ¤t, const QMode highlightBookmarks(); } -void EventBrowser::on_HideFindJump() +void EventBrowser::on_HideFind() { - ui->jumpStrip->hide(); ui->findStrip->hide(); - ui->jumpToEID->setText(QString()); + ui->find->setChecked(false); ui->findEvent->setText(QString()); m_Model->SetFindText(QString()); updateFindResultsAvailable(); } -void EventBrowser::on_jumpToEID_returnPressed() -{ - bool ok = false; - uint eid = ui->jumpToEID->text().toUInt(&ok); - if(ok) - { - SelectEvent(eid); - } -} - void EventBrowser::findHighlight_timeout() { m_Model->SetFindText(ui->findEvent->text()); @@ -2450,19 +2441,15 @@ void EventBrowser::events_keyPress(QKeyEvent *event) if(event->modifiers() == Qt::ControlModifier) { - if(event->key() == Qt::Key_F) + // support Ctrl-G as a legacy shortcut, from the old 'goto EID' which was separate from find + if(event->key() == Qt::Key_F || event->key() == Qt::Key_G) { - on_find_clicked(); - event->accept(); - } - else if(event->key() == Qt::Key_G) - { - on_gotoEID_clicked(); + on_find_toggled(true); event->accept(); } else if(event->key() == Qt::Key_L) { - on_filter_clicked(); + on_filter_toggled(true); event->accept(); } else if(event->key() == Qt::Key_B) diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index 8aa8784f2..d59896085 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -75,13 +75,11 @@ public: private slots: // automatic slots - void on_find_clicked(); - void on_filter_clicked(); - void on_gotoEID_clicked(); + void on_find_toggled(bool checked); + void on_filter_toggled(bool checked); void on_timeDraws_clicked(); void on_bookmark_clicked(); - void on_HideFindJump(); - void on_jumpToEID_returnPressed(); + void on_HideFind(); void on_findEvent_returnPressed(); void on_findEvent_keyPress(QKeyEvent *event); void on_findEvent_textEdited(const QString &arg1); diff --git a/qrenderdoc/Windows/EventBrowser.ui b/qrenderdoc/Windows/EventBrowser.ui index fdc7d7c82..09dc924fe 100644 --- a/qrenderdoc/Windows/EventBrowser.ui +++ b/qrenderdoc/Windows/EventBrowser.ui @@ -107,6 +107,12 @@ :/find.png:/find.png + + true + + + false + true @@ -121,22 +127,11 @@ :/filter.png:/filter.png - + true - - - - - - Jump to an Event by EID - - - - - - - :/flag_green.png:/flag_green.png + + false true @@ -231,83 +226,6 @@ - - - - - 3 - - - 6 - - - 0 - - - 6 - - - 0 - - - - - - - - :/flag_green.png - - - - - - - Jump to Event - - - Qt::PlainText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 0 - - - - - - - - 0 - 20 - - - - Event ID - - - true - - - - - - - - - - - :/cross.png:/cross.png - - - true - - - - - -