Skip to content

Conversation

@flameflows
Copy link

Description

This PR introduces the ability to manually reorder event bookmarks in the Event Browser.

Implementation details:

  • Backend Logic: Implemented the underlying logic to swap a bookmark's position with its neighbor in the capture context's list.
  • Context Menu: Extended the bookmark context menu to include "Move Left" and "Move Right" actions, grouped alongside the existing Rename and Delete options.
  • Layout Refresh: Modified the bookmark list update mechanism to ensure the button widgets are physically re-ordered in the UI layout when a move occurs, strictly following the new order in the data.

@flameflows flameflows force-pushed the feature/shift-bookmarks branch 8 times, most recently from 1f5f1c2 to 0289e1b Compare January 1, 2026 21:30
@flameflows flameflows force-pushed the feature/shift-bookmarks branch from 0289e1b to d98cd18 Compare January 1, 2026 21:37
@Zorro666 Zorro666 self-assigned this Jan 4, 2026
Copy link
Collaborator

@Zorro666 Zorro666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this. Personally occasionally I have wanted to be able to reorder bookmarks and I have usually deleted them and readded them in the order I want which is time consuming and error prone.

Ideally there might be a full UI for reordering the bookmarks using a list with drag'n'drop but that is a fair amount of UI work and this PR is a good balance of not much code and brings useful functionality.

I think this could be built on to easily add actions to move the bookmark to the Start or End as well as Left/Right which would bring a decent set of basic re-ordering for the bookmarks and this fits well with using an enum to describe the movement of the bookmark in the ShiftBookmark method.

Ideally but not essential the context menu would grey out the movement options which are not applicable i.e. Move Left is disabled for the bookmark at the start. One way to achieve that could be by passing in the bookmark index from repopulateBookmarks to bookmarkContextMenu or getting the bookmarks in bookmarkContextMenu to find the position.

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 direction: The direction to move.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would benefit from being an enum instead of an int
The enum could be more expressive


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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be good to early return if "newIndex == index"

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R : keyboard shortcut is already used by Rename : need to choose a different character


QAction renameBookmark(tr("&Rename"), this);
QAction deleteBookmark(tr("&Delete"), this);
QAction moveLeft(tr("Move &Left"), this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to add an appropriate icon for the new context actions. Perhaps
Icons::arrow_left()
Icons::arrow_right()

m_BookmarkStripLayout->removeItem(m_BookmarkSpacer);
m_BookmarkStripLayout->addWidget(but);
m_BookmarkStripLayout->addItem(m_BookmarkSpacer);
m_BookmarkButtons[EID] = but;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is required ? It is already set on line 5343

)");
virtual void RemoveBookmark(uint32_t eventId) = 0;

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some spaces are missing:

"list.This" -> "list. This"
"givenevent" -> "given event"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants