Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions qrenderdoc/Code/CaptureContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,34 @@ void CaptureContext::RemoveBookmark(uint32_t EID)
RefreshUIStatus({}, true, true);
}

void CaptureContext::ShiftBookmark(uint32_t EID, int dir)
{
int index = -1;

for(int i = 0; i < m_Bookmarks.count(); i++)
{
if(m_Bookmarks[i].eventId == EID)
{
index = i;
break;
}
}

if(index == -1)
return;

int newIndex = index + dir;

if(newIndex < 0 || newIndex >= m_Bookmarks.count())
return;

std::swap(m_Bookmarks[index], m_Bookmarks[newIndex]);

SetModification(CaptureModifications::Bookmarks);
RefreshUIStatus({}, true, true);
}


void CaptureContext::DelayedCallback(uint32_t milliseconds, std::function<void()> callback)
{
QTimer::singleShot(milliseconds, callback);
Expand Down
1 change: 1 addition & 0 deletions qrenderdoc/Code/CaptureContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class CaptureContext : public ICaptureContext, IExtensionManager
rdcarray<EventBookmark> GetBookmarks() override { return m_Bookmarks; }
void SetBookmark(const EventBookmark &mark) override;
void RemoveBookmark(uint32_t EID) override;
void ShiftBookmark(uint32_t EID, int dir) override;
void EmbedDependentFiles() override;
void RemoveDependentFiles() override;

Expand Down
10 changes: 10 additions & 0 deletions qrenderdoc/Code/Interface/QRDInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,16 @@ Use :meth:`RemoveDependentFiles` to remove the embedded file data.
Externally referenced files which can't be found on disk are skipped.
For remote replay the modifications are performed on the remote machine and copied back to the local host.
)");

virtual void ShiftBookmark(uint32_t EID, int dir) = 0;

DOCUMENT(R"(Reorders a bookmark by shifting its position in the bookmark list.This allows manual reordering of bookmarks.

The bookmark associated with the givenevent ID is swapped with the adjacent bookmark in the specified direction.
:param int EID: The event ID of the bookmark to move.
:param int dir: The direction to move.
)");

virtual void EmbedDependentFiles() = 0;

DOCUMENT(R"(Removes the dependent files storage from the capture i.e. shader debug files.
Expand Down
31 changes: 28 additions & 3 deletions qrenderdoc/Windows/EventBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5344,9 +5344,10 @@ void EventBrowser::repopulateBookmarks()

highlightBookmarks();

m_BookmarkStripLayout->removeItem(m_BookmarkSpacer);
m_BookmarkStripLayout->addWidget(but);
m_BookmarkStripLayout->addItem(m_BookmarkSpacer);
//m_BookmarkStripLayout->removeItem(m_BookmarkSpacer);
//m_BookmarkStripLayout->addWidget(but);
//m_BookmarkStripLayout->addItem(m_BookmarkSpacer);
m_BookmarkButtons[EID] = but;
}
}

Expand All @@ -5359,6 +5360,15 @@ void EventBrowser::repopulateBookmarks()
m_BookmarkButtons.remove(EID);
}
}
m_BookmarkStripLayout->removeItem(m_BookmarkSpacer);
for (const EventBookmark &mark : bookmarks) {
if (m_BookmarkButtons.contains(mark.eventId)) {
QRClickToolButton *but = m_BookmarkButtons[mark.eventId];
m_BookmarkStripLayout->removeWidget(but);
m_BookmarkStripLayout->addWidget(but);
}
}
m_BookmarkStripLayout->addItem(m_BookmarkSpacer);

ui->bookmarkStrip->setVisible(!bookmarks.isEmpty());

Expand Down Expand Up @@ -5393,12 +5403,17 @@ void EventBrowser::bookmarkContextMenu(QRClickToolButton *button, uint32_t EID)

QAction renameBookmark(tr("&Rename"), this);
QAction deleteBookmark(tr("&Delete"), this);
QAction moveLeft(tr("Move &Left"), this);
QAction moveRight(tr("Move &Right"), this);

renameBookmark.setIcon(Icons::page_white_edit());
deleteBookmark.setIcon(Icons::del());

contextMenu.addAction(&renameBookmark);
contextMenu.addAction(&deleteBookmark);
contextMenu.addSeparator();
contextMenu.addAction(&moveLeft);
contextMenu.addAction(&moveRight);

QObject::connect(&deleteBookmark, &QAction::triggered, [this, EID]() {
m_Ctx.RemoveBookmark(EID);
Expand Down Expand Up @@ -5429,6 +5444,16 @@ void EventBrowser::bookmarkContextMenu(QRClickToolButton *button, uint32_t EID)
}
}
});

QObject::connect(&moveLeft, &QAction::triggered, [this, EID]() {
m_Ctx.ShiftBookmark(EID, -1);
repopulateBookmarks();
});

QObject::connect(&moveRight, &QAction::triggered, [this, EID]() {
m_Ctx.ShiftBookmark(EID, 1);
repopulateBookmarks();
});

RDDialog::show(&contextMenu, QCursor::pos());
}
Expand Down
4 changes: 4 additions & 0 deletions qrenderdoc/Windows/PythonShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
{
InvokeVoidFunction(&ICaptureContext::RemoveBookmark, EID);
}
virtual void ShiftBookmark(uint32_t EID, int dir) override
{
InvokeVoidFunction(&ICaptureContext::ShiftBookmark, EID, dir);
}
virtual void EmbedDependentFiles() override
{
InvokeVoidFunction(&ICaptureContext::EmbedDependentFiles);
Expand Down
Loading