1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

Profiler: Add fixed track headers to the timeline view

The architecture here is a little bit convoluted. I ended up making a
new container widget (TimelineContainer) that works similarly to
GUI::ScrollableContainerWidget but has two subwidgets (a fixed header
that only scrolls vertically, and the timeline view that scrolls on
both axes.)

It would be nice to generalize this mechanism eventually and move it
back into LibGUI, but for now let's go with a special widget for
Profiler so we can continue iterating on the GUI. :^)
This commit is contained in:
Andreas Kling 2021-05-06 19:50:18 +02:00
parent 59da118f2e
commit fb6d236ba2
7 changed files with 201 additions and 21 deletions

View file

@ -74,15 +74,6 @@ void TimelineTrack::paint_event(GUI::PaintEvent& event)
int select_hover_x = (int)((float)(normalized_hover_time - start_of_trace) * column_width);
painter.fill_rect({ select_start_x, frame_thickness(), select_end_x - select_start_x, height() - frame_thickness() * 2 }, Color(0, 0, 0, 60));
painter.fill_rect({ select_hover_x, frame_thickness(), 1, height() - frame_thickness() * 2 }, Color::NamedColor::Black);
auto text = String::formatted("{} ({})", m_process.executable, m_process.pid);
Gfx::IntRect text_rect {
frame_thickness() + 3,
frame_thickness() + 3,
font().width(text),
font().glyph_height()
};
painter.draw_text(text_rect, text, font());
}
u64 TimelineTrack::timestamp_at_x(int x) const