mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
Profiler: Add TimelineView widget and make the timeline cursor global
There's no longer a cursor in each process timeline, instead the parent widget keeps track of it (along with the selection) and it all moves in sync.
This commit is contained in:
parent
84c4c2d884
commit
abc3ad01b2
6 changed files with 103 additions and 28 deletions
56
Userland/DevTools/Profiler/TimelineView.h
Normal file
56
Userland/DevTools/Profiler/TimelineView.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
namespace Profiler {
|
||||
|
||||
class ProfileTimelineWidget;
|
||||
|
||||
class TimelineView final : public GUI::Widget {
|
||||
C_OBJECT(TimelineView);
|
||||
|
||||
public:
|
||||
virtual ~TimelineView() override;
|
||||
|
||||
bool is_selecting() const { return m_selecting; }
|
||||
u64 select_start_time() const { return m_select_start_time; }
|
||||
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)
|
||||
{
|
||||
m_selecting = value;
|
||||
update();
|
||||
}
|
||||
void set_select_start_time(Badge<ProfileTimelineWidget>, u64 value)
|
||||
{
|
||||
m_select_start_time = value;
|
||||
update();
|
||||
}
|
||||
void set_select_end_time(Badge<ProfileTimelineWidget>, u64 value)
|
||||
{
|
||||
m_select_end_time = value;
|
||||
update();
|
||||
}
|
||||
void set_hover_time(Badge<ProfileTimelineWidget>, u64 value)
|
||||
{
|
||||
m_hover_time = value;
|
||||
update();
|
||||
}
|
||||
|
||||
private:
|
||||
TimelineView();
|
||||
|
||||
bool m_selecting { false };
|
||||
u64 m_select_start_time { 0 };
|
||||
u64 m_select_end_time { 0 };
|
||||
u64 m_hover_time { 0 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue