1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:57:34 +00:00

Profiler: Rename ProfileTimelineWidget => TimelineTrack

This commit is contained in:
Andreas Kling 2021-05-06 19:00:48 +02:00
parent abc3ad01b2
commit 814200f8da
5 changed files with 22 additions and 21 deletions

View file

@ -6,8 +6,8 @@ set(SOURCES
ProcessPickerWidget.cpp
Profile.cpp
ProfileModel.cpp
ProfileTimelineWidget.cpp
SamplesModel.cpp
TimelineTrack.cpp
SamplesModel.cpp
TimelineView.cpp
)

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "ProfileTimelineWidget.h"
#include "TimelineTrack.h"
#include "Profile.h"
#include "TimelineView.h"
#include <LibGUI/Painter.h>
@ -13,7 +13,7 @@
namespace Profiler {
ProfileTimelineWidget::ProfileTimelineWidget(TimelineView& view, Profile& profile, Process const& process)
TimelineTrack::TimelineTrack(TimelineView& view, Profile& profile, Process const& process)
: m_view(view)
, m_profile(profile)
, m_process(process)
@ -25,11 +25,11 @@ ProfileTimelineWidget::ProfileTimelineWidget(TimelineView& view, Profile& profil
set_frame_thickness(1);
}
ProfileTimelineWidget::~ProfileTimelineWidget()
TimelineTrack::~TimelineTrack()
{
}
void ProfileTimelineWidget::paint_event(GUI::PaintEvent& event)
void TimelineTrack::paint_event(GUI::PaintEvent& event)
{
GUI::Frame::paint_event(event);
@ -97,14 +97,14 @@ void ProfileTimelineWidget::paint_event(GUI::PaintEvent& event)
}
}
u64 ProfileTimelineWidget::timestamp_at_x(int x) const
u64 TimelineTrack::timestamp_at_x(int x) const
{
float column_width = (float)frame_inner_rect().width() / (float)m_profile.length_in_ms();
float ms_into_profile = (float)x / column_width;
return m_profile.first_timestamp() + (u64)ms_into_profile;
}
void ProfileTimelineWidget::mousedown_event(GUI::MouseEvent& event)
void TimelineTrack::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
return;
@ -116,7 +116,7 @@ void ProfileTimelineWidget::mousedown_event(GUI::MouseEvent& event)
update();
}
void ProfileTimelineWidget::mousemove_event(GUI::MouseEvent& event)
void TimelineTrack::mousemove_event(GUI::MouseEvent& event)
{
m_view.set_hover_time({}, timestamp_at_x(event.x()));
@ -128,7 +128,7 @@ void ProfileTimelineWidget::mousemove_event(GUI::MouseEvent& event)
update();
}
void ProfileTimelineWidget::mouseup_event(GUI::MouseEvent& event)
void TimelineTrack::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
return;

View file

@ -14,10 +14,11 @@ class Process;
class Profile;
class TimelineView;
class ProfileTimelineWidget final : public GUI::Frame {
C_OBJECT(ProfileTimelineWidget)
class TimelineTrack final : public GUI::Frame {
C_OBJECT(TimelineTrack);
public:
virtual ~ProfileTimelineWidget() override;
virtual ~TimelineTrack() override;
private:
virtual void paint_event(GUI::PaintEvent&) override;
@ -25,7 +26,7 @@ private:
virtual void mousemove_event(GUI::MouseEvent&) override;
virtual void mouseup_event(GUI::MouseEvent&) override;
explicit ProfileTimelineWidget(TimelineView&, Profile&, Process const&);
explicit TimelineTrack(TimelineView&, Profile&, Process const&);
u64 timestamp_at_x(int x) const;

View file

@ -10,7 +10,7 @@
namespace Profiler {
class ProfileTimelineWidget;
class TimelineTrack;
class TimelineView final : public GUI::Widget {
C_OBJECT(TimelineView);
@ -23,22 +23,22 @@ public:
u64 select_end_time() const { return m_select_end_time; }
u64 hover_time() const { return m_hover_time; }
void set_selecting(Badge<ProfileTimelineWidget>, bool value)
void set_selecting(Badge<TimelineTrack>, bool value)
{
m_selecting = value;
update();
}
void set_select_start_time(Badge<ProfileTimelineWidget>, u64 value)
void set_select_start_time(Badge<TimelineTrack>, u64 value)
{
m_select_start_time = value;
update();
}
void set_select_end_time(Badge<ProfileTimelineWidget>, u64 value)
void set_select_end_time(Badge<TimelineTrack>, u64 value)
{
m_select_end_time = value;
update();
}
void set_hover_time(Badge<ProfileTimelineWidget>, u64 value)
void set_hover_time(Badge<TimelineTrack>, u64 value)
{
m_hover_time = value;
update();

View file

@ -7,7 +7,7 @@
#include "IndividualSampleModel.h"
#include "ProcessPickerWidget.h"
#include "Profile.h"
#include "ProfileTimelineWidget.h"
#include "TimelineTrack.h"
#include "TimelineView.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/ElapsedTimer.h>
@ -99,7 +99,7 @@ int main(int argc, char** argv)
}
if (!event_count)
continue;
timeline_view->add<ProfileTimelineWidget>(*timeline_view, *profile, process);
timeline_view->add<TimelineTrack>(*timeline_view, *profile, process);
}
auto& scrollable_container = main_widget.add<GUI::ScrollableContainerWidget>();