-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathTaskManagerWidget.cpp
53 lines (39 loc) · 1.13 KB
/
TaskManagerWidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2024, Andrew Kaster <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "TaskManagerWidget.h"
#include <LibGUI/BoxLayout.h>
#include <LibWebView/OutOfProcessWebView.h>
#include <LibWebView/ProcessManager.h>
namespace Browser {
TaskManagerWidget::~TaskManagerWidget() = default;
TaskManagerWidget::TaskManagerWidget()
{
m_update_timer = Core::Timer::create_repeating(1000, [this] {
this->update_statistics();
});
m_update_timer->start();
m_web_view = add<WebView::OutOfProcessWebView>();
set_layout<GUI::VerticalBoxLayout>(4);
set_fill_with_background_color(true);
m_web_view->set_focus(true);
update_statistics();
}
void TaskManagerWidget::show_event(GUI::ShowEvent& event)
{
m_update_timer->start();
GUI::Widget::show_event(event);
}
void TaskManagerWidget::hide_event(GUI::HideEvent& event)
{
m_update_timer->stop();
GUI::Widget::hide_event(event);
}
void TaskManagerWidget::update_statistics()
{
WebView::ProcessManager::the().update_all_processes();
m_web_view->load_html(WebView::ProcessManager::the().generate_html());
}
}